зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1757457 - [devtools] Recompute mCanExecuteScripts after navigation r=smaug
I can see that after navigation, allowJavascript is correctly set for the browsing context, but it seems we need to call RecomputeCanExecuteScripts() to force it to be applied to the new page. Not sure if doing this here makes sense or if it should be done earlier. Also there are still other issues with this feature: - closing the toolbox does not reload the page: meaning JavaScript remains disabled on the page - similarly all pages which have been put in bfcache will retain the javascript disabled/enabled setting For the first issue, I wonder if we should force a reload when closing the toolbox (iff javascript disabled was toggled). And for the second issue, could we invalidate contexts put in bfcache for a given browsing context when we toggle allowJavaScript? Olli: Does this change make sense at least to fix the basic issue? Differential Revision: https://phabricator.services.mozilla.com/D169182
This commit is contained in:
Родитель
d7352a1d58
Коммит
66eca9e88c
|
@ -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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
|
Загрузка…
Ссылка в новой задаче