Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion browser_patches/firefox/UPSTREAM_CONFIG.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
REMOTE_URL="https://github.com/mozilla-firefox/firefox"
BASE_BRANCH="release"
BASE_REVISION="d065a04bc5610f496762935dee56604a78b91b51"
BASE_REVISION="f1b6c0f86b96b7e0688c26f65803576f27cdaf88"
10 changes: 1 addition & 9 deletions browser_patches/firefox/juggler/NetworkObserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,6 @@ class NetworkRequest {
try {
remoteIPAddress = this.httpChannel.remoteAddress;
remotePort = this.httpChannel.remotePort;
// Gecko reports bare IPv6 addresses, bracket them to match Chromium.
if (remoteIPAddress && remoteIPAddress.includes(':'))
remoteIPAddress = `[${remoteIPAddress}]`;
} catch (e) {
// remoteAddress is not defined for cached requests.
}
Expand Down Expand Up @@ -909,12 +906,7 @@ class ResponseStorage {
// Note: fulfilled request comes with decoded body right away.
if ((request.httpChannel instanceof Ci.nsIEncodedChannel) && request.httpChannel.contentEncodings && !request.httpChannel.applyConversion && !request._fulfilled) {
const encodingHeader = request.httpChannel.getResponseHeader("Content-Encoding");
// Firefox itself skips "identity" and empty encodings when applying content
// conversions, and there is no stream converter registered for them.
encodings = encodingHeader.split(/\s*\t*,\s*\t*/).filter(encoding => {
const normalized = encoding.trim().toLowerCase();
return normalized && normalized !== 'identity' && normalized !== 'x-identity';
});
encodings = encodingHeader.split(/\s*\t*,\s*\t*/);
}
this._responses.set(request.requestId, {
body,
Expand Down
2 changes: 1 addition & 1 deletion browser_patches/firefox/juggler/TargetRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

const {Helper} = ChromeUtils.importESModule('chrome://juggler/content/Helper.js');
const {Preferences} = ChromeUtils.importESModule("resource://gre/modules/Preferences.sys.mjs");
const {ContextualIdentityService} = ChromeUtils.importESModule("moz-src:///toolkit/components/contextualidentity/ContextualIdentityService.sys.mjs");
const {ContextualIdentityService} = ChromeUtils.importESModule("resource://gre/modules/ContextualIdentityService.sys.mjs");
const {NetUtil} = ChromeUtils.importESModule('resource://gre/modules/NetUtil.sys.mjs');
const {AppConstants} = ChromeUtils.importESModule("resource://gre/modules/AppConstants.sys.mjs");

Expand Down
2 changes: 1 addition & 1 deletion browser_patches/firefox/juggler/components/Juggler.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ ActorManagerParent.addJSWindowActors({
},
},
allFrames: true,
safeForUntrustedWebProcess: true,
},
});

Expand Down Expand Up @@ -159,3 +158,4 @@ const jugglerInstance = new Juggler();
export var JugglerFactory = function() {
return jugglerInstance;
};

50 changes: 19 additions & 31 deletions browser_patches/firefox/juggler/content/Runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ const disallowedMessageCategories = new Set([
class Runtime {
constructor(isWorker = false) {
this._debugger = new Debugger();
// A debuggee global with these flags unset is pinned to the debuggable wasm/asm.js
// baseline tier, with the optimizing compiler disabled entirely.
this._debugger.allowUnobservedWasm = true;
this._debugger.allowUnobservedAsmJS = true;
this._pendingPromises = new Map();
this._executionContexts = new Map();
this._windowToExecutionContext = new Map();
Expand Down Expand Up @@ -261,37 +257,29 @@ class Runtime {
resolve = a;
reject = b;
});
this._pendingPromises.set(obj.promiseID, {resolve, reject, executionContext, exceptionDetails, promiseObj: obj});
// Debugger.onPromiseSettled hook was removed in Bug 2044167. Instead, attach
// reactions inside the debuggee that run a `debugger;` statement upon settling,
// and sweep pending promises from the onDebuggerStatement hook. Unlike
// dereferencing the promise and adding reactions from the privileged
// compartment, this also works in workers where there are no Xrays.
this._pendingPromises.set(obj.promiseID, {resolve, reject, executionContext, exceptionDetails});
if (this._pendingPromises.size === 1)
this._debugger.onDebuggerStatement = this._onDebuggerStatement.bind(this);
executionContext._debuggee.executeInGlobalWithBindings(
'p.then(() => { debugger; }, () => { debugger; })', {p: obj}, {useInnerBindings: true});
this._debugger.onPromiseSettled = this._onPromiseSettled.bind(this);
return await promise;
}

_onDebuggerStatement() {
for (const [promiseID, pendingPromise] of this._pendingPromises) {
const obj = pendingPromise.promiseObj;
if (obj.promiseState === 'pending')
continue;
this._pendingPromises.delete(promiseID);
if (obj.promiseState === 'fulfilled') {
pendingPromise.resolve({success: true, obj: obj.promiseValue});
continue;
}
const debuggee = pendingPromise.executionContext._debuggee;
const errorInfo = debuggee.executeInGlobalWithBindings('({m: e?.message, s: e?.stack})', {e: obj.promiseReason}, {useInnerBindings: true}).return;
pendingPromise.exceptionDetails.text = errorInfo.getOwnPropertyDescriptor('m').value;
pendingPromise.exceptionDetails.stack = errorInfo.getOwnPropertyDescriptor('s').value;
pendingPromise.resolve({success: false, obj: null});
}
_onPromiseSettled(obj) {
const pendingPromise = this._pendingPromises.get(obj.promiseID);
if (!pendingPromise)
return;
this._pendingPromises.delete(obj.promiseID);
if (!this._pendingPromises.size)
this._debugger.onDebuggerStatement = undefined;
this._debugger.onPromiseSettled = undefined;

if (obj.promiseState === 'fulfilled') {
pendingPromise.resolve({success: true, obj: obj.promiseValue});
return;
};
const debuggee = pendingPromise.executionContext._debuggee;
const errorInfo = debuggee.executeInGlobalWithBindings('({m: e?.message, s: e?.stack})', {e: obj.promiseReason}, {useInnerBindings: true}).return;
pendingPromise.exceptionDetails.text = errorInfo.getOwnPropertyDescriptor('m').value;
pendingPromise.exceptionDetails.stack = errorInfo.getOwnPropertyDescriptor('s').value;
pendingPromise.resolve({success: false, obj: null});
}

createExecutionContext(domWindow, contextGlobal, auxData) {
Expand Down Expand Up @@ -319,7 +307,7 @@ class Runtime {
}
}
if (!this._pendingPromises.size)
this._debugger.onDebuggerStatement = undefined;
this._debugger.onPromiseSettled = undefined;
this._debugger.removeDebuggee(destroyedContext._contextGlobal);
this._executionContexts.delete(destroyedContext._id);
if (destroyedContext._domWindow)
Expand Down
4 changes: 0 additions & 4 deletions browser_patches/firefox/juggler/content/WorkerMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ const runtime = new Runtime(true /* isWorker */);
// Create execution context in the runtime only when the script
// source was actually evaluated in it.
const dbg = new Debugger(global);
// A debuggee global with these flags unset is pinned to the debuggable wasm/asm.js
// baseline tier, with the optimizing compiler disabled entirely.
dbg.allowUnobservedWasm = true;
dbg.allowUnobservedAsmJS = true;
if (dbg.findScripts({global}).length) {
runtime.createExecutionContext(null /* domWindow */, global, {});
} else {
Expand Down
Loading