mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-02 13:27:33 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
6414271c91
47 changed files with 3341 additions and 1968 deletions
|
|
@ -320,12 +320,11 @@ DOMMatrixReadOnly::ScaleNonUniform(double aScaleX,
|
|||
}
|
||||
|
||||
already_AddRefed<DOMMatrix>
|
||||
DOMMatrixReadOnly::Rotate(double aAngle,
|
||||
double aOriginX ,
|
||||
double aOriginY) const
|
||||
{
|
||||
DOMMatrixReadOnly::Rotate(double aRotX,
|
||||
const Optional<double>& aRotY,
|
||||
const Optional<double>& aRotZ) const {
|
||||
RefPtr<DOMMatrix> retval = new DOMMatrix(mParent, *this);
|
||||
retval->RotateSelf(aAngle, aOriginX, aOriginY);
|
||||
retval->RotateSelf(aRotX, aRotY, aRotZ);
|
||||
|
||||
return retval.forget();
|
||||
}
|
||||
|
|
@ -893,28 +892,52 @@ DOMMatrix::RotateFromVectorSelf(double aX, double aY)
|
|||
return this;
|
||||
}
|
||||
|
||||
RotateSelf(atan2(aY, aX) / radPerDegree);
|
||||
const double angle = atan2(aY, aX);
|
||||
|
||||
if (fmod(angle, 2 * M_PI) == 0) {
|
||||
return this;
|
||||
}
|
||||
|
||||
if (mMatrix3D) {
|
||||
RotateAxisAngleSelf(0, 0, 1, angle / radPerDegree);
|
||||
} else {
|
||||
*mMatrix2D = mMatrix2D->PreRotate(angle);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
DOMMatrix*
|
||||
DOMMatrix::RotateSelf(double aAngle, double aOriginX, double aOriginY)
|
||||
{
|
||||
if (fmod(aAngle, 360) == 0) {
|
||||
return this;
|
||||
DOMMatrix* DOMMatrix::RotateSelf(double aRotX, const Optional<double>& aRotY,
|
||||
const Optional<double>& aRotZ) {
|
||||
double rotY;
|
||||
double rotZ;
|
||||
if (!aRotY.WasPassed() && !aRotZ.WasPassed()) {
|
||||
rotZ = aRotX;
|
||||
aRotX = 0;
|
||||
rotY = 0;
|
||||
} else {
|
||||
rotY = aRotY.WasPassed() ? aRotY.Value() : 0;
|
||||
rotZ = aRotZ.WasPassed() ? aRotZ.Value() : 0;
|
||||
}
|
||||
|
||||
TranslateSelf(aOriginX, aOriginY);
|
||||
if (aRotX != 0 || rotY != 0) {
|
||||
Ensure3DMatrix();
|
||||
}
|
||||
|
||||
if (mMatrix3D) {
|
||||
RotateAxisAngleSelf(0, 0, 1, aAngle);
|
||||
} else {
|
||||
*mMatrix2D = mMatrix2D->PreRotate(aAngle * radPerDegree);
|
||||
if (fmod(rotZ, 360) != 0) {
|
||||
mMatrix3D->RotateZ(rotZ * radPerDegree);
|
||||
}
|
||||
if (fmod(rotY, 360) != 0) {
|
||||
mMatrix3D->RotateY(rotY * radPerDegree);
|
||||
}
|
||||
if (fmod(aRotX, 360) != 0) {
|
||||
mMatrix3D->RotateX(aRotX * radPerDegree);
|
||||
}
|
||||
} else if (fmod(rotZ, 360) != 0) {
|
||||
*mMatrix2D = mMatrix2D->PreRotate(rotZ * radPerDegree);
|
||||
}
|
||||
|
||||
TranslateSelf(-aOriginX, -aOriginY);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -191,9 +191,9 @@ public:
|
|||
double aOriginX = 0,
|
||||
double aOriginY = 0,
|
||||
double aOriginZ = 0) const;
|
||||
already_AddRefed<DOMMatrix> Rotate(double aAngle,
|
||||
double aOriginX = 0,
|
||||
double aOriginY = 0) const;
|
||||
already_AddRefed<DOMMatrix> Rotate(double aRotX,
|
||||
const Optional<double>& aRotY,
|
||||
const Optional<double>& aRotZ) const;
|
||||
already_AddRefed<DOMMatrix> RotateFromVector(double aX,
|
||||
double aY) const;
|
||||
already_AddRefed<DOMMatrix> RotateAxisAngle(double aX,
|
||||
|
|
@ -324,9 +324,9 @@ public:
|
|||
double aOriginX = 0,
|
||||
double aOriginY = 0,
|
||||
double aOriginZ = 0);
|
||||
DOMMatrix* RotateSelf(double aAngle,
|
||||
double aOriginX = 0,
|
||||
double aOriginY = 0);
|
||||
DOMMatrix* RotateSelf(double aRotX,
|
||||
const Optional<double>& aRotY,
|
||||
const Optional<double>& aRotZ);
|
||||
DOMMatrix* RotateFromVectorSelf(double aX,
|
||||
double aY);
|
||||
DOMMatrix* RotateAxisAngleSelf(double aX,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@
|
|||
#include "nsIContentIterator.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsContainerFrame.h"
|
||||
|
|
@ -149,6 +148,8 @@
|
|||
#include "nsDOMStringMap.h"
|
||||
#include "DOMIntersectionObserver.h"
|
||||
|
||||
#include "nsDocShell.h" // for ::Cast
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
|
|
@ -2259,12 +2260,15 @@ Element::GetPrimaryFrame(mozFlushType aType)
|
|||
nsresult
|
||||
Element::LeaveLink(nsPresContext* aPresContext)
|
||||
{
|
||||
nsILinkHandler *handler = aPresContext->GetLinkHandler();
|
||||
if (!handler) {
|
||||
if (!aPresContext || !aPresContext->Document()->LinkHandlingEnabled()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return handler->OnLeaveLink();
|
||||
nsIDocShell* shell = aPresContext->Document()->GetDocShell();
|
||||
if (!shell) {
|
||||
return NS_OK;
|
||||
}
|
||||
return nsDocShell::Cast(shell)->OnLeaveLink();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
@ -3175,7 +3179,6 @@ Element::CheckHandleEventForLinksPrecondition(EventChainVisitor& aVisitor,
|
|||
(aVisitor.mEvent->mMessage != eMouseClick) &&
|
||||
(aVisitor.mEvent->mMessage != eKeyPress) &&
|
||||
(aVisitor.mEvent->mMessage != eLegacyDOMActivate)) ||
|
||||
!aVisitor.mPresContext ||
|
||||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -3220,7 +3223,7 @@ Element::GetEventTargetParentForLinks(EventChainPreVisitor& aVisitor)
|
|||
if (!focusEvent || !focusEvent->mIsRefocus) {
|
||||
nsAutoString target;
|
||||
GetLinkTarget(target);
|
||||
nsContentUtils::TriggerLink(this, aVisitor.mPresContext, absURI, target,
|
||||
nsContentUtils::TriggerLink(this, absURI, target,
|
||||
false, true, true);
|
||||
// Make sure any ancestor links don't also TriggerLink
|
||||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
|
||||
|
|
@ -3272,20 +3275,20 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
|||
switch (aVisitor.mEvent->mMessage) {
|
||||
case eMouseDown:
|
||||
{
|
||||
if (aVisitor.mEvent->AsMouseEvent()->button ==
|
||||
WidgetMouseEvent::eLeftButton) {
|
||||
// don't make the link grab the focus if there is no link handler
|
||||
nsILinkHandler *handler = aVisitor.mPresContext->GetLinkHandler();
|
||||
nsIDocument *document = GetComposedDoc();
|
||||
if (handler && document) {
|
||||
if (aVisitor.mEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton &&
|
||||
OwnerDoc()->LinkHandlingEnabled()) {
|
||||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
|
||||
|
||||
if (IsInComposedDoc()) {
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm) {
|
||||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
|
||||
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(this);
|
||||
fm->SetFocus(elem, nsIFocusManager::FLAG_BYMOUSE |
|
||||
nsIFocusManager::FLAG_NOSCROLL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (aVisitor.mPresContext) {
|
||||
EventStateManager::SetActiveManager(
|
||||
aVisitor.mPresContext->EventStateManager(), this);
|
||||
}
|
||||
|
|
@ -3302,19 +3305,18 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
|||
}
|
||||
|
||||
// The default action is simply to dispatch DOMActivate
|
||||
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
|
||||
if (shell) {
|
||||
// single-click
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
// DOMActive event should be trusted since the activation is actually
|
||||
// occurred even if the cause is an untrusted click event.
|
||||
InternalUIEvent actEvent(true, eLegacyDOMActivate, mouseEvent);
|
||||
actEvent.mDetail = 1;
|
||||
|
||||
rv = shell->HandleDOMEventWithTarget(this, &actEvent, &status);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
// The DOMActive event should be trusted since the activation has actually
|
||||
// occurred even if the cause is an untrusted click event.
|
||||
// This is a hack to allow click events to happen on anchors outside document
|
||||
// contexts (where there is no presShell)... Thanks, Google, for another ugly one.
|
||||
InternalUIEvent actEvent(true, eLegacyDOMActivate, mouseEvent);
|
||||
actEvent.mDetail = 1;
|
||||
|
||||
rv = EventDispatcher::Dispatch(this, aVisitor.mPresContext, &actEvent,
|
||||
nullptr, &status);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -3326,7 +3328,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
|||
GetLinkTarget(target);
|
||||
const InternalUIEvent* activeEvent = aVisitor.mEvent->AsUIEvent();
|
||||
MOZ_ASSERT(activeEvent);
|
||||
nsContentUtils::TriggerLink(this, aVisitor.mPresContext, absURI, target,
|
||||
nsContentUtils::TriggerLink(this, absURI, target,
|
||||
true, true, activeEvent->IsTrustable());
|
||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
#include "mozilla/EventStates.h" // for member
|
||||
#include "mozilla/dom/DirectionalityUtils.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsINodeList.h"
|
||||
#include "nsNodeUtils.h"
|
||||
#include "nsAttrAndChildArray.h"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIContentIterator.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@
|
|||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsCycleCollector.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsDocShell.h"
|
||||
#include "nsDocShellCID.h"
|
||||
#include "nsDocument.h"
|
||||
#include "nsDOMCID.h"
|
||||
|
|
@ -5336,25 +5337,24 @@ nsContentUtils::CombineResourcePrincipals(nsCOMPtr<nsIPrincipal>* aResourcePrinc
|
|||
|
||||
/* static */
|
||||
void
|
||||
nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
|
||||
nsContentUtils::TriggerLink(nsIContent *aContent,
|
||||
nsIURI *aLinkURI, const nsString &aTargetSpec,
|
||||
bool aClick, bool aIsUserTriggered,
|
||||
bool aIsTrusted)
|
||||
{
|
||||
NS_ASSERTION(aPresContext, "Need a nsPresContext");
|
||||
NS_PRECONDITION(aLinkURI, "No link URI");
|
||||
|
||||
if (aContent->IsEditable()) {
|
||||
if (aContent->IsEditable() || !aContent->OwnerDoc()->LinkHandlingEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsILinkHandler *handler = aPresContext->GetLinkHandler();
|
||||
if (!handler) {
|
||||
nsCOMPtr<nsIDocShell> docShell = aContent->OwnerDoc()->GetDocShell();
|
||||
if (!docShell) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!aClick) {
|
||||
handler->OnOverLink(aContent, aLinkURI, aTargetSpec.get());
|
||||
nsDocShell::Cast(docShell)->OnOverLink(aContent, aLinkURI, aTargetSpec.get());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -5397,9 +5397,9 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
handler->OnLinkClick(aContent, aLinkURI,
|
||||
fileName.IsVoid() ? aTargetSpec.get() : EmptyString().get(),
|
||||
fileName, nullptr, nullptr, aIsTrusted, aContent->NodePrincipal());
|
||||
nsDocShell::Cast(docShell)->OnLinkClick(aContent, aLinkURI,
|
||||
fileName.IsVoid() ? aTargetSpec.get() : EmptyString().get(),
|
||||
fileName, nullptr, nullptr, aIsTrusted, aContent->NodePrincipal());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1711,7 +1711,6 @@ public:
|
|||
* security check using aContent's principal.
|
||||
*
|
||||
* @param aContent the node on which a link was triggered.
|
||||
* @param aPresContext the pres context, must be non-null.
|
||||
* @param aLinkURI the URI of the link, must be non-null.
|
||||
* @param aTargetSpec the target (like target=, may be empty).
|
||||
* @param aClick whether this was a click or not (if false, this method
|
||||
|
|
@ -1722,7 +1721,7 @@ public:
|
|||
* @param aIsTrusted If false, JS Context will be pushed to stack
|
||||
* when the link is triggered.
|
||||
*/
|
||||
static void TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
|
||||
static void TriggerLink(nsIContent *aContent,
|
||||
nsIURI *aLinkURI, const nsString& aTargetSpec,
|
||||
bool aClick, bool aIsUserTriggered,
|
||||
bool aIsTrusted);
|
||||
|
|
|
|||
|
|
@ -1288,6 +1288,7 @@ nsIDocument::nsIDocument()
|
|||
|
||||
nsDocument::nsDocument(const char* aContentType)
|
||||
: nsIDocument()
|
||||
, mLinksEnabled(true)
|
||||
, mViewportType(Unknown)
|
||||
{
|
||||
SetContentTypeInternal(nsDependentCString(aContentType));
|
||||
|
|
|
|||
|
|
@ -412,6 +412,14 @@ public:
|
|||
virtual void RemoveIDTargetObserver(nsIAtom* aID, IDTargetObserver aObserver,
|
||||
void* aData, bool aForImage) override;
|
||||
|
||||
virtual void SetLinkHandlingEnabled(bool aValue) override {
|
||||
mLinksEnabled = aValue;
|
||||
}
|
||||
|
||||
virtual bool LinkHandlingEnabled() override {
|
||||
return mLinksEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Access HTTP header data (this may also get set from other sources, like
|
||||
* HTML META tags).
|
||||
|
|
@ -1223,6 +1231,10 @@ public:
|
|||
// Recorded time of change to 'loading' state.
|
||||
mozilla::TimeStamp mLoadingTimeStamp;
|
||||
|
||||
// False if we've disabled link handling for elements inside this document,
|
||||
// true otherwise.
|
||||
bool mLinksEnabled : 1;
|
||||
|
||||
// True if the document has been detached from its content viewer.
|
||||
bool mIsGoingAway:1;
|
||||
// True if the document is being destroyed.
|
||||
|
|
|
|||
|
|
@ -767,6 +767,9 @@ public:
|
|||
mSandboxFlags = sandboxFlags;
|
||||
}
|
||||
|
||||
virtual void SetLinkHandlingEnabled(bool aValue) = 0;
|
||||
virtual bool LinkHandlingEnabled() = 0;
|
||||
|
||||
/**
|
||||
* Access HTTP header data (this may also get set from other
|
||||
* sources, like HTML META tags).
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@
|
|||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIEditorIMESupport.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "mozilla/dom/NodeInfo.h"
|
||||
#include "mozilla/dom/NodeInfoInlines.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
|
|
|||
|
|
@ -199,16 +199,9 @@ HTMLAnchorElement::IsHTMLFocusable(bool aWithMouse,
|
|||
}
|
||||
|
||||
// cannot focus links if there is no link handler
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (doc) {
|
||||
nsIPresShell* presShell = doc->GetShell();
|
||||
if (presShell) {
|
||||
nsPresContext* presContext = presShell->GetPresContext();
|
||||
if (presContext && !presContext->GetLinkHandler()) {
|
||||
*aIsFocusable = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!OwnerDoc()->LinkHandlingEnabled()) {
|
||||
*aIsFocusable = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Links that are in an editable region should never be focusable, even if
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsDocShell.h" // for ::Cast
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
|
|
@ -776,9 +777,8 @@ HTMLFormElement::SubmitSubmission(HTMLFormSubmission* aFormSubmission)
|
|||
|
||||
// If there is no link handler, then we won't actually be able to submit.
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
nsCOMPtr<nsISupports> container = doc ? doc->GetContainer() : nullptr;
|
||||
nsCOMPtr<nsILinkHandler> linkHandler(do_QueryInterface(container));
|
||||
if (!linkHandler || IsEditable()) {
|
||||
nsCOMPtr<nsIDocShell> container = doc ? doc->GetDocShell() : nullptr;
|
||||
if (!container || IsEditable()) {
|
||||
mIsSubmitting = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -857,12 +857,12 @@ HTMLFormElement::SubmitSubmission(HTMLFormSubmission* aFormSubmission)
|
|||
getter_AddRefs(postDataStream));
|
||||
NS_ENSURE_SUBMIT_SUCCESS(rv);
|
||||
|
||||
rv = linkHandler->OnLinkClickSync(this, actionURI,
|
||||
target.get(),
|
||||
NullString(),
|
||||
postDataStream, nullptr,
|
||||
getter_AddRefs(docShell),
|
||||
getter_AddRefs(mSubmittingRequest));
|
||||
rv = nsDocShell::Cast(container)->OnLinkClickSync(this, actionURI,
|
||||
target.get(),
|
||||
NullString(),
|
||||
postDataStream, nullptr,
|
||||
getter_AddRefs(docShell),
|
||||
getter_AddRefs(mSubmittingRequest));
|
||||
NS_ENSURE_SUBMIT_SUCCESS(rv);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIForm.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIFormControl.h"
|
||||
|
|
|
|||
|
|
@ -581,27 +581,14 @@ nsGenericHTMLElement::FindAncestorForm(HTMLFormElement* aCurrentForm)
|
|||
}
|
||||
|
||||
bool
|
||||
nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(
|
||||
EventChainVisitor& aVisitor)
|
||||
nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(EventChainVisitor& aVisitor)
|
||||
{
|
||||
NS_PRECONDITION(nsCOMPtr<Link>(do_QueryObject(this)),
|
||||
"should be called only when |this| implements |Link|");
|
||||
|
||||
if (!aVisitor.mPresContext) {
|
||||
// We need a pres context to do link stuff. Some events (e.g. mutation
|
||||
// events) don't have one.
|
||||
// XXX: ideally, shouldn't we be able to do what we need without one?
|
||||
return false;
|
||||
}
|
||||
|
||||
//Need to check if we hit an imagemap area and if so see if we're handling
|
||||
//the event on that map or on a link farther up the tree. If we're on a
|
||||
//link farther up, do nothing.
|
||||
nsCOMPtr<nsIContent> target = aVisitor.mPresContext->EventStateManager()->
|
||||
GetEventTargetContent(aVisitor.mEvent);
|
||||
|
||||
return !target || !target->IsHTMLElement(nsGkAtoms::area) ||
|
||||
IsHTMLElement(nsGkAtoms::area);
|
||||
// When not in the composed document DOM, only <a> should navigate away per
|
||||
// the exception in https://html.spec.whatwg.org/#cannot-navigate
|
||||
// Thanks, Google, for another ugly one. :|
|
||||
return IsInComposedDoc() || IsHTMLElement(nsGkAtoms::a);
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ else:
|
|||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/docshell/base',
|
||||
'/dom/base',
|
||||
'/dom/plugins/ipc',
|
||||
'/layout/generic',
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ using mozilla::DefaultXDisplay;
|
|||
#include "nsIStringStream.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsILinkHandler.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
|
@ -46,6 +45,7 @@ using mozilla::DefaultXDisplay;
|
|||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsDocShell.h" // for ::Cast
|
||||
#include "ImageContainer.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "GLContext.h"
|
||||
|
|
@ -440,10 +440,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL,
|
|||
}
|
||||
|
||||
// the container of the pres context will give us the link handler
|
||||
nsCOMPtr<nsISupports> container = presContext->GetContainerWeak();
|
||||
nsCOMPtr<nsIDocShell> container = presContext->GetDocShell();
|
||||
NS_ENSURE_TRUE(container,NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsILinkHandler> lh = do_QueryInterface(container);
|
||||
NS_ENSURE_TRUE(lh, NS_ERROR_FAILURE);
|
||||
|
||||
nsAutoString unitarget;
|
||||
if ((0 == PL_strcmp(aTarget, "newwindow")) ||
|
||||
|
|
@ -495,8 +493,14 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL,
|
|||
triggeringPrincipal = BasePrincipal::CreateCodebasePrincipal(uri, attrs);
|
||||
}
|
||||
|
||||
rv = lh->OnLinkClick(content, uri, unitarget.get(), NullString(),
|
||||
aPostStream, headersDataStream, true, triggeringPrincipal);
|
||||
rv = nsDocShell::Cast(container)->OnLinkClick(content,
|
||||
uri,
|
||||
unitarget.get(),
|
||||
NullString(),
|
||||
aPostStream,
|
||||
headersDataStream,
|
||||
true,
|
||||
triggeringPrincipal);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -642,6 +642,11 @@ nsCSPParser::nonceSource()
|
|||
if (dashIndex < 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!isValidBase64Value(expr.BeginReading() + dashIndex + 1, expr.EndReading())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// cache if encountering hash or nonce to invalidate unsafe-inline
|
||||
mHasHashOrNonce = true;
|
||||
return new nsCSPNonceSrc(Substring(expr,
|
||||
|
|
@ -671,6 +676,10 @@ nsCSPParser::hashSource()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (!isValidBase64Value(expr.BeginReading() + dashIndex + 1, expr.EndReading())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsAutoString algo(Substring(expr, 0, dashIndex));
|
||||
nsAutoString hash(Substring(expr, dashIndex + 1, expr.Length() - dashIndex + 1));
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,33 @@ isValidHexDig(char16_t aHexDig)
|
|||
(aHexDig >= 'a' && aHexDig <= 'f'));
|
||||
}
|
||||
|
||||
// Checks grammar for valid base-64 strings. Does not verify decodability.
|
||||
static bool
|
||||
isValidBase64Value(const char16_t* cur, const char16_t* end)
|
||||
{
|
||||
// Using grammar at https://w3c.github.io/webappsec-csp/#grammardef-nonce-source
|
||||
|
||||
// May end with one or two =
|
||||
if (end > cur && *(end-1) == EQUALS) end--;
|
||||
if (end > cur && *(end-1) == EQUALS) end--;
|
||||
|
||||
// Must have at least one character aside from any =
|
||||
if (end == cur) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Rest must all be A-Za-z0-9+/-_
|
||||
for (; cur < end; ++cur) {
|
||||
if (!(isCharacterToken(*cur) || isNumberToken(*cur) ||
|
||||
*cur == PLUS || *cur == SLASH ||
|
||||
*cur == DASH || *cur == UNDERLINE)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ============================================
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
|||
|
|
@ -227,6 +227,10 @@ TEST(CSPParser, Directives)
|
|||
"report-uri http://www.example.com/" },
|
||||
{ "script-src 'nonce-correctscriptnonce'",
|
||||
"script-src 'nonce-correctscriptnonce'" },
|
||||
{ "script-src 'nonce-a'",
|
||||
"script-src 'nonce-a'" },
|
||||
{ "script-src 'sha256-a'",
|
||||
"script-src 'sha256-a'" },
|
||||
{ "script-src 'sha256-siVR8vAcqP06h2ppeNwqgjr0yZ6yned4X2VF84j4GmI='",
|
||||
"script-src 'sha256-siVR8vAcqP06h2ppeNwqgjr0yZ6yned4X2VF84j4GmI='" },
|
||||
{ "require-sri-for script style",
|
||||
|
|
@ -543,6 +547,34 @@ TEST(CSPParser, PoliciesWithInvalidSrc)
|
|||
"script-src 'none'" },
|
||||
{ "script-src http://www.example.com:*.",
|
||||
"script-src 'none'" },
|
||||
{ "script-src 'nonce-{invalid}'",
|
||||
"script-src 'none'" },
|
||||
{ "script-src 'sha256-{invalid}'",
|
||||
"script-src 'none'" },
|
||||
{ "script-src 'nonce-in$valid'",
|
||||
"script-src 'none'" },
|
||||
{ "script-src 'sha256-in$valid'",
|
||||
"script-src 'none'" },
|
||||
{ "script-src 'nonce-invalid==='",
|
||||
"script-src 'none'" },
|
||||
{ "script-src 'sha256-invalid==='",
|
||||
"script-src 'none'" },
|
||||
{ "script-src 'nonce-==='",
|
||||
"script-src 'none'" },
|
||||
{ "script-src 'sha256-==='",
|
||||
"script-src 'none'" },
|
||||
{ "script-src 'nonce-=='",
|
||||
"script-src 'none'" },
|
||||
{ "script-src 'sha256-=='",
|
||||
"script-src 'none'" },
|
||||
{ "script-src 'nonce-='",
|
||||
"script-src 'none'" },
|
||||
{ "script-src 'sha256-='",
|
||||
"script-src 'none'" },
|
||||
{ "script-src 'nonce-'",
|
||||
"script-src 'none'" },
|
||||
{ "script-src 'sha256-'",
|
||||
"script-src 'none'" },
|
||||
{ "connect-src http://www.example.com/foo%zz;",
|
||||
"connect-src 'none'" },
|
||||
{ "script-src https://foo.com/%$",
|
||||
|
|
|
|||
|
|
@ -59,15 +59,15 @@ interface DOMMatrixReadOnly {
|
|||
optional unrestricted double originX = 0,
|
||||
optional unrestricted double originY = 0,
|
||||
optional unrestricted double originZ = 0);
|
||||
DOMMatrix rotate(unrestricted double angle,
|
||||
optional unrestricted double originX = 0,
|
||||
optional unrestricted double originY = 0);
|
||||
DOMMatrix rotateFromVector(unrestricted double x,
|
||||
unrestricted double y);
|
||||
DOMMatrix rotateAxisAngle(unrestricted double x,
|
||||
unrestricted double y,
|
||||
unrestricted double z,
|
||||
unrestricted double angle);
|
||||
[NewObject] DOMMatrix rotate(optional unrestricted double rotX = 0,
|
||||
optional unrestricted double rotY,
|
||||
optional unrestricted double rotZ);
|
||||
[NewObject] DOMMatrix rotateFromVector(optional unrestricted double x = 0,
|
||||
optional unrestricted double y = 0);
|
||||
[NewObject] DOMMatrix rotateAxisAngle(optional unrestricted double x = 0,
|
||||
optional unrestricted double y = 0,
|
||||
optional unrestricted double z = 0,
|
||||
optional unrestricted double angle = 0);
|
||||
DOMMatrix skewX(unrestricted double sx);
|
||||
DOMMatrix skewY(unrestricted double sy);
|
||||
[NewObject, Throws] DOMMatrix multiply(optional DOMMatrixInit other);
|
||||
|
|
@ -141,15 +141,15 @@ interface DOMMatrix : DOMMatrixReadOnly {
|
|||
optional unrestricted double originX = 0,
|
||||
optional unrestricted double originY = 0,
|
||||
optional unrestricted double originZ = 0);
|
||||
DOMMatrix rotateSelf(unrestricted double angle,
|
||||
optional unrestricted double originX = 0,
|
||||
optional unrestricted double originY = 0);
|
||||
DOMMatrix rotateFromVectorSelf(unrestricted double x,
|
||||
unrestricted double y);
|
||||
DOMMatrix rotateAxisAngleSelf(unrestricted double x,
|
||||
unrestricted double y,
|
||||
unrestricted double z,
|
||||
unrestricted double angle);
|
||||
DOMMatrix rotateSelf(optional unrestricted double rotX = 0,
|
||||
optional unrestricted double rotY,
|
||||
optional unrestricted double rotZ);
|
||||
DOMMatrix rotateFromVectorSelf(optional unrestricted double x = 0,
|
||||
optional unrestricted double y = 0);
|
||||
DOMMatrix rotateAxisAngleSelf(optional unrestricted double x = 0,
|
||||
optional unrestricted double y = 0,
|
||||
optional unrestricted double z = 0,
|
||||
optional unrestricted double angle = 0);
|
||||
DOMMatrix skewXSelf(unrestricted double sx);
|
||||
DOMMatrix skewYSelf(unrestricted double sy);
|
||||
DOMMatrix invertSelf();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue