Skip to content

Commit 00d5a50

Browse files
author
Cristian Tuns
committed
Backed out 15 changesets (bug 1794001, bug 1793995, bug 1693271) for causing build bustages CLOSED TREE
Backed out changeset 5d4b0c23342f (bug 1793995) Backed out changeset 79a5023e7822 (bug 1793995) Backed out changeset 4330821df43f (bug 1793995) Backed out changeset a653699a5cef (bug 1793995) Backed out changeset 264a0154514e (bug 1793995) Backed out changeset 6773cada61a8 (bug 1793995) Backed out changeset d55a78f3627a (bug 1793995) Backed out changeset 16299839e25e (bug 1793995) Backed out changeset 10c5cf69b3f0 (bug 1693271) Backed out changeset 84e7bf515c94 (bug 1693271) Backed out changeset b8dbabe61a9a (bug 1794001) Backed out changeset 3cfe4087793d (bug 1794001) Backed out changeset dd03b0396eb9 (bug 1794001) Backed out changeset d4f9b4a3029a (bug 1794001) Backed out changeset 148d136ce549 (bug 1794001)
1 parent 69b0c55 commit 00d5a50

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+674
-17156
lines changed

Cargo.lock

Lines changed: 9 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

caps/ContentPrincipal.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -513,20 +513,17 @@ nsresult ContentPrincipal::GetSiteIdentifier(SiteIdentifier& aSite) {
513513
}
514514

515515
WebExtensionPolicy* ContentPrincipal::AddonPolicy() {
516-
AssertIsOnMainThread();
517-
518516
if (!mAddon.isSome()) {
519517
NS_ENSURE_TRUE(mURI, nullptr);
520518

521-
WebExtensionPolicy* policy =
522-
mURI->SchemeIs("moz-extension") ? EPS().GetByURL(mURI.get()) : nullptr;
523-
mAddon.emplace(policy ? policy->Core() : nullptr);
519+
if (mURI->SchemeIs("moz-extension")) {
520+
mAddon.emplace(EPS().GetByURL(mURI.get()));
521+
} else {
522+
mAddon.emplace(nullptr);
523+
}
524524
}
525525

526-
if (extensions::WebExtensionPolicyCore* policy = mAddon.ref()) {
527-
return policy->GetMainThreadPolicy();
528-
}
529-
return nullptr;
526+
return mAddon.value();
530527
}
531528

532529
NS_IMETHODIMP

caps/ContentPrincipal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class ContentPrincipal final : public BasePrincipal {
7676
private:
7777
const nsCOMPtr<nsIURI> mURI;
7878
nsCOMPtr<nsIURI> mDomain;
79-
Maybe<RefPtr<extensions::WebExtensionPolicyCore>> mAddon;
79+
Maybe<WeakPtr<extensions::WebExtensionPolicy>> mAddon;
8080
};
8181

8282
} // namespace mozilla

dom/chrome-webidl/MatchGlob.webidl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
[ChromeOnly, Exposed=Window]
1212
interface MatchGlob {
1313
[Throws]
14-
constructor(UTF8String glob, optional boolean allowQuestion = true);
15-
14+
constructor(DOMString glob, optional boolean allowQuestion = true);
15+
1616
/**
1717
* Returns true if the string matches the glob.
1818
*/
19-
boolean matches(UTF8String string);
19+
boolean matches(DOMString string);
2020

2121
/**
2222
* The glob string this MatchGlob represents.
2323
*/
2424
[Constant]
25-
readonly attribute UTF8String glob;
25+
readonly attribute DOMString glob;
2626
};

dom/chrome-webidl/WebExtensionContentScript.webidl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface URI;
77
interface WindowProxy;
88

99
typedef (MatchPatternSet or sequence<DOMString>) MatchPatternSetOrStringSequence;
10-
typedef (MatchGlob or UTF8String) MatchGlobOrString;
10+
typedef (MatchGlob or DOMString) MatchGlobOrString;
1111

1212
[ChromeOnly, Exposed=Window]
1313
interface MozDocumentMatcher {
@@ -74,6 +74,21 @@ interface MozDocumentMatcher {
7474
[Constant]
7575
readonly attribute MatchPatternSet? excludeMatches;
7676

77+
/**
78+
* A set of glob matchers for URLs in which this script should run. If this
79+
* list is present, the script will only run in URLs which match the
80+
* `matches` pattern as well as one of these globs.
81+
*/
82+
[Cached, Constant, Frozen]
83+
readonly attribute sequence<MatchGlob>? includeGlobs;
84+
85+
/**
86+
* A set of glob matchers for URLs in which this script should not run, even
87+
* if they match other include patterns or globs.
88+
*/
89+
[Cached, Constant, Frozen]
90+
readonly attribute sequence<MatchGlob>? excludeGlobs;
91+
7792
/**
7893
* The originAttributesPattern for which this script should be enabled for.
7994
*/

dom/chrome-webidl/WebExtensionPolicy.webidl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,14 @@ interface WebExtensionPolicy {
176176
* URL root is listed as a web accessible path. Access checks on a path, such
177177
* as performed in nsScriptSecurityManager, use sourceMayAccessPath below.
178178
*/
179-
boolean isWebAccessiblePath(UTF8String pathname);
179+
boolean isWebAccessiblePath(DOMString pathname);
180180

181181
/**
182182
* Returns true if the given path relative to the extension's moz-extension:
183183
* URL root may be accessed by web content at sourceURI. For Manifest V2,
184184
* sourceURI is ignored and the path must merely be listed as web accessible.
185185
*/
186-
boolean sourceMayAccessPath(URI sourceURI, UTF8String pathname);
186+
boolean sourceMayAccessPath(URI sourceURI, DOMString pathname);
187187

188188
/**
189189
* Replaces localization placeholders in the given string with localized

dom/ipc/jsactor/JSWindowActorProtocol.cpp

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "mozilla/dom/PContent.h"
1616
#include "mozilla/dom/WindowGlobalChild.h"
1717

18-
#include "mozilla/extensions/MatchPattern.h"
1918
#include "nsContentUtils.h"
2019
#include "JSActorProtocolUtils.h"
2120

@@ -29,7 +28,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(JSWindowActorProtocol)
2928
NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
3029
NS_INTERFACE_MAP_END
3130

32-
NS_IMPL_CYCLE_COLLECTION(JSWindowActorProtocol)
31+
NS_IMPL_CYCLE_COLLECTION(JSWindowActorProtocol, mURIMatcher)
3332

3433
/* static */ already_AddRefed<JSWindowActorProtocol>
3534
JSWindowActorProtocol::FromIPC(const JSWindowActorInfo& aInfo) {
@@ -294,18 +293,30 @@ void JSWindowActorProtocol::RemoveObservers() {
294293
}
295294
}
296295

297-
extensions::MatchPatternSetCore* JSWindowActorProtocol::GetURIMatcher() {
296+
extensions::MatchPatternSet* JSWindowActorProtocol::GetURIMatcher() {
298297
// If we've already created the pattern set, return it.
299298
if (mURIMatcher || mMatches.IsEmpty()) {
300299
return mURIMatcher;
301300
}
302301

303-
nsTArray<RefPtr<extensions::MatchPatternCore>> patterns(mMatches.Length());
304-
for (const nsString& pattern : mMatches) {
305-
patterns.AppendElement(new extensions::MatchPatternCore(
306-
pattern, false, false, IgnoreErrors()));
302+
// Constructing the MatchPatternSet requires a JS environment to be run in.
303+
// We can construct it here in the JSM scope, as we will be keeping it around.
304+
AutoJSAPI jsapi;
305+
MOZ_ALWAYS_TRUE(jsapi.Init(xpc::PrivilegedJunkScope()));
306+
GlobalObject global(jsapi.cx(), xpc::PrivilegedJunkScope());
307+
308+
nsTArray<OwningStringOrMatchPattern> patterns;
309+
patterns.SetCapacity(mMatches.Length());
310+
for (nsString& s : mMatches) {
311+
auto entry = patterns.AppendElement();
312+
entry->SetAsString() = s;
307313
}
308-
mURIMatcher = new extensions::MatchPatternSetCore(std::move(patterns));
314+
315+
MatchPatternOptions matchPatternOptions;
316+
// Make MatchPattern's mSchemes create properly.
317+
matchPatternOptions.mRestrictSchemes = false;
318+
mURIMatcher = extensions::MatchPatternSet::Constructor(
319+
global, patterns, matchPatternOptions, IgnoreErrors());
309320
return mURIMatcher;
310321
}
311322

@@ -365,7 +376,7 @@ bool JSWindowActorProtocol::Matches(BrowsingContext* aBrowsingContext,
365376
return false;
366377
}
367378

368-
if (extensions::MatchPatternSetCore* uriMatcher = GetURIMatcher()) {
379+
if (extensions::MatchPatternSet* uriMatcher = GetURIMatcher()) {
369380
if (!uriMatcher->Matches(aURI)) {
370381
aRv.ThrowNotSupportedError(nsPrintfCString(
371382
"Window protocol '%s' doesn't match uri %s", mName.get(),

dom/ipc/jsactor/JSWindowActorProtocol.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class JSWindowActorProtocol final : public JSActorProtocol,
7777

7878
private:
7979
explicit JSWindowActorProtocol(const nsACString& aName) : mName(aName) {}
80-
extensions::MatchPatternSetCore* GetURIMatcher();
80+
extensions::MatchPatternSet* GetURIMatcher();
8181
bool RemoteTypePrefixMatches(const nsDependentCSubstring& aRemoteType);
8282
bool MessageManagerGroupMatches(BrowsingContext* aBrowsingContext);
8383
~JSWindowActorProtocol() = default;
@@ -94,7 +94,7 @@ class JSWindowActorProtocol final : public JSActorProtocol,
9494
ParentSide mParent;
9595
ChildSide mChild;
9696

97-
RefPtr<extensions::MatchPatternSetCore> mURIMatcher;
97+
RefPtr<extensions::MatchPatternSet> mURIMatcher;
9898
};
9999

100100
} // namespace dom

dom/security/nsContentSecurityUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ FilenameTypeAndDetails nsContentSecurityUtils::FilenameToFilenameType(
459459
sanitizedPathAndScheme.Append(u"can't get addon off main thread]"_ns);
460460
}
461461

462-
AppendUTF8toUTF16(url.FilePath(), sanitizedPathAndScheme);
462+
sanitizedPathAndScheme.Append(url.FilePath());
463463
return FilenameTypeAndDetails(kExtensionURI, Some(sanitizedPathAndScheme));
464464
}
465465

supply-chain/audits.toml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -941,33 +941,6 @@ who = "Mike Hommey <mh+mozilla@glandium.org>"
941941
criteria = "safe-to-deploy"
942942
delta = "0.7.0 -> 0.7.1"
943943

944-
[[audits.rure]]
945-
who = "Nika Layzell <nika@thelayzells.com>"
946-
criteria = "safe-to-deploy"
947-
version = "0.2.2"
948-
notes = """
949-
This is a fairly straightforward FFI wrapper crate for `regex`, maintained by
950-
the `regex` developers in the same repository.
951-
952-
This crate is explicitly designed for FFI use, and should not be used directly
953-
by Rust code. The exported `extern \"C\"` functions are not marked as `unsafe`,
954-
meaning that it is technically incorrect to use them from within Rust code,
955-
however they are reasonable to use from C code.
956-
957-
The unsafe code in this crate heavily depends on the C caller maintaining
958-
invariants, however these invariants are clearly documented in the `rure.h`
959-
file, bundled with the crate.
960-
961-
I have checked the signatures of each function both in C++ and in the Rust to
962-
ensure they match. In some places, the c `rure.h` header file is missing a
963-
`const` qualifier which could be present given the Rust code, however this will
964-
have no impact on ABI, and is fairly normal for FFI crates.
965-
966-
Panics are handled in all Rust FFI methods, meaning that projects which do not
967-
disable unwinding will still consistently abort (using `libc::abort()`) if a
968-
panic occurs in the Rust code.
969-
"""
970-
971944
[[audits.rust_decimal]]
972945
who = "Mike Hommey <mh+mozilla@glandium.org>"
973946
criteria = "safe-to-deploy"

0 commit comments

Comments
 (0)