There was already a carveout to not treat moz-safe-about:blank as a principal,
this expands it to the other URI which gets a moz-safe-about inner URI, which
is moz-safe-about:srcdoc. Like about:blank, about:srcdoc doesn't actually have
a meaningful principal, so we should never create a moz-safe-about:srcdoc
content principal.
Differential Revision: https://phabricator.services.mozilla.com/D301900
This changes the way that the principal for a Blob URL is inferred to instead
be based on the URL within the BlobURL, unless the URL's origin part is
"null".
In order to continue to support system-principal Blobs without needing to
broadcast the principal around, they are given a special origin part of
"system". This changes some tests which were specifically looking for the
"blob:null" prefix.
Differential Revision: https://phabricator.services.mozilla.com/D276055
This reverts commit 47367770c3.
Revert "Bug 2005247 - Part 3: Always read BlobURL info over IPC, r=asuth"
This reverts commit df37ac38f8.
Revert "Bug 2005247 - Part 2: Validate BlobURL ContentLength header during channel fetch, r=asuth,necko-reviewers,valentin"
This reverts commit 45e63e6920.
Revert "Bug 2005247 - Part 1: Get the BlobImpl from the BlobURLChannel, r=asuth,media-playback-reviewers,padenot"
This reverts commit 440a33211b.
Revert "Bug 2005002 - Part 5: sec-fetch-storage-access not implemented for workers, r=manuel"
This reverts commit 5654faf8a0.
Revert "Bug 2005002 - Part 4: Fix devtools tests for blob: URL dedicated worker changes, r=devtools-reviewers,ochameau"
This reverts commit 9c9c197990.
Revert "Bug 2005002 - Part 3: Extension content scripts for Blob URLs no longer match with full paths, r=extension-reviewers,robwu"
This reverts commit 55f399175f.
Revert "Bug 2005002 - Part 2: Infer Blob URL principal from URL when possible, r=asuth,extension-reviewers,necko-reviewers,home-newtab-reviewers,robwu,mconley,kershaw,bvandersloot"
This reverts commit d3022ec470.
Revert "Bug 2005002 - Part 1: Support do_QueryObject for nsSimpleURI and subclasses, r=necko-reviewers,valentin,asuth"
This reverts commit 3d1199b4d4.
This changes the way that the principal for a Blob URL is inferred to instead
be based on the URL within the BlobURL, unless the URL's origin part is
"null".
In order to continue to support system-principal Blobs without needing to
broadcast the principal around, they are given a special origin part of
"system". This changes some tests which were specifically looking for the
"blob:null" prefix.
Differential Revision: https://phabricator.services.mozilla.com/D276055
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
The most expensive step in ValidatePrincipal is currently building a
SiteOriginNoSuffix from a ContentPrincipal. This codepath has become more hot
due to new checks using ValidatePrincipal.
This refactors the code to avoid doing any work on the principal in more cases.
The new codepath only computes a different siteOrigin for http(s) URIs, which I
believe should be correct. It also does manual parsing of the origin which was
built by GenerateOriginNoSuffixForURI in order to avoid unnecessary calls to
the URI parser.
Differential Revision: https://phabricator.services.mozilla.com/D242420
This changes out almost all places `AddonPolicy()` is used within nsIPrincipal
implementations, replacing it with the threadsafe `AddonPolicyCore()` method
and `WebExtensionPolicyCore` type.
Differential Revision: https://phabricator.services.mozilla.com/D163040
This is required for deserializing nsIPrincipal instances from PrincipalInfo to
be threadsafe, as setting domain with `SetDomain()` is only safe on the main
thread, due to it enumerating and updating JS wrappers.
Differential Revision: https://phabricator.services.mozilla.com/D163036
This patch only makes the very basics of nsIPrincipal manipulation threadsafe,
such as reference counting, and some trivial methods. The more complex methods
will be made threadsafe in following parts.
Differential Revision: https://phabricator.services.mozilla.com/D163032
This threadsafe core type also acts as a weak reference to the main-thread
WebExtensionPolicy when needed. This will be used when information about a
WebExtension is needed to be accessible off-main-thread in the future.
Differential Revision: https://phabricator.services.mozilla.com/D158879
This threadsafe core type also acts as a weak reference to the main-thread
WebExtensionPolicy when needed. This will be used when information about a
WebExtension is needed to be accessible off-main-thread in the future.
Differential Revision: https://phabricator.services.mozilla.com/D158879
This threadsafe core type also acts as a weak reference to the main-thread
WebExtensionPolicy when needed. This will be used when information about a
WebExtension is needed to be accessible off-main-thread in the future.
Differential Revision: https://phabricator.services.mozilla.com/D158879
Attempting to get the siteOrigin for a URI of something like "https://.mozilla.org"
was returning NS_ERROR_ILLEGAL_VALUE, which caused breakage in parts of the browser
UI when trying to initialize a window to point at that URI.
It looks like the NS_ERROR_ILLEGAL_VALUE stuff was added back in bug 1491728 as
part of an effort to better handle some IPv6 stuff. I tested the STR in bug 1491728
for the original bug, and I cannot reproduce the issue even witht his change.
nika suggested that instead of returning NS_ERROR_ILLEGAL_VALUE for this form of
URI, we return the same value as `nsIPrincipal.origin`.
Differential Revision: https://phabricator.services.mozilla.com/D142493
This is a step towards separating the mutable state on principals from const
state which can be made threadsafe. The remaining mutable fields will either
need to be moved off of nsIPrincipal or made threadsafe to destroy (e.g. using
nsMainThreadPtrHandle) and stored behind a mutex.
Serialization is handled for most types using a separate Deserializer class,
like how it was handled with `nsIURI` mutators. SystemPrincipal wasn't changed
as the `Read` method is a no-op for that class.
Differential Revision: https://phabricator.services.mozilla.com/D115092