diff --git a/devtools/client/framework/test/browser_toolbox_options_disable_js.js b/devtools/client/framework/test/browser_toolbox_options_disable_js.js index 0018420e791e..20458a7eb592 100644 --- a/devtools/client/framework/test/browser_toolbox_options_disable_js.js +++ b/devtools/client/framework/test/browser_toolbox_options_disable_js.js @@ -21,6 +21,13 @@ add_task(async function() { await testJSDisabled(); await testJSDisabledIframe(); + // Navigate and check JS is still disabled + for (let i = 0; i < 10; i++) { + await navigateTo(`${TEST_URI}?nocache=${i}`); + await testJSDisabled(); + await testJSDisabledIframe(); + } + // Re-enable JS. await toggleJS(toolbox); diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp index e5e8720e9071..b20b52bf776d 100644 --- a/docshell/base/BrowsingContext.cpp +++ b/docshell/base/BrowsingContext.cpp @@ -610,6 +610,8 @@ void BrowsingContext::SetDocShell(nsIDocShell* aDocShell) { if (mChildSessionHistory) { mChildSessionHistory->SetIsInProcess(true); } + + RecomputeCanExecuteScripts(); } // This class implements a callback that will return the remote window proxy for diff --git a/docshell/test/unit/test_allowJavascript.js b/docshell/test/unit/test_allowJavascript.js index e9d2f60fca3b..cab251f465b8 100644 --- a/docshell/test/unit/test_allowJavascript.js +++ b/docshell/test/unit/test_allowJavascript.js @@ -261,8 +261,29 @@ add_task(async function() { bc.reload(0); await AllowJavascriptParent.promiseLoad(bc); - await assertLoadFired(bc, undefined, "top BC with scripts disabled"); - await assertScriptsAllowed(bc, false, "top BC with scripts disabled"); + await assertLoadFired( + bc, + undefined, + "top BC with scripts disabled after reload" + ); + await assertScriptsAllowed( + bc, + false, + "top BC with scripts disabled after reload" + ); + + await page.loadURL("http://example.org/?other"); + + await assertLoadFired( + bc, + undefined, + "top BC with scripts disabled after navigation" + ); + await assertScriptsAllowed( + bc, + false, + "top BC with scripts disabled after navigation" + ); await page.close(); Services.prefs.clearUserPref("dom.security.https_first");