зеркало из https://github.com/mozilla/gecko-dev.git
Bug 956826 - Check docShell's private browsing state when the frame script is loaded r=yoric
From ee65809c2e3e3eec807b8b2c4cbc0599da1d8377 Mon Sep 17 00:00:00 2001
This commit is contained in:
Родитель
ee3fc51cac
Коммит
44248265ff
|
@ -380,6 +380,12 @@ let SessionStorageListener = {
|
|||
let PrivacyListener = {
|
||||
init: function() {
|
||||
docShell.addWeakPrivacyTransitionObserver(this);
|
||||
|
||||
// Check that value at startup as it might have
|
||||
// been set before the frame script was loaded.
|
||||
if (docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing) {
|
||||
MessageQueue.push("isPrivate", () => true);
|
||||
}
|
||||
},
|
||||
|
||||
// Ci.nsIPrivacyTransitionObserver
|
||||
|
|
|
@ -64,6 +64,28 @@ add_task(function() {
|
|||
}
|
||||
});
|
||||
|
||||
add_task(function () {
|
||||
const FRAME_SCRIPT = "data:," +
|
||||
"docShell.QueryInterface%28Ci.nsILoadContext%29.usePrivateBrowsing%3Dtrue";
|
||||
|
||||
// Create a new window to attach our frame script to.
|
||||
let win = yield promiseNewWindowLoaded();
|
||||
win.messageManager.loadFrameScript(FRAME_SCRIPT, true);
|
||||
|
||||
// Create a new tab in the new window that will load the frame script.
|
||||
let tab = win.gBrowser.addTab("about:mozilla");
|
||||
let browser = tab.linkedBrowser;
|
||||
yield promiseBrowserLoaded(browser);
|
||||
SyncHandlers.get(browser).flush();
|
||||
|
||||
// Check that we consider the tab as private.
|
||||
let state = JSON.parse(ss.getTabState(tab));
|
||||
ok(state.isPrivate, "tab considered private");
|
||||
|
||||
// Cleanup.
|
||||
yield promiseWindowClosed(win);
|
||||
});
|
||||
|
||||
function setUsePrivateBrowsing(browser, val) {
|
||||
return sendMessage(browser, "ss-test:setUsePrivateBrowsing", val);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче