mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1069059 - [e10s] Convert isWindowPrivate calls to isBrowserPrivate/isContentWindowPrivate as appropriate (r=mconley,margaret)
This commit is contained in:
parent
3351de0867
commit
91adbce542
@ -312,7 +312,7 @@ var PlacesCommandHook = {
|
||||
PlacesUtils.transactionManager.doTransaction(txn);
|
||||
itemId = txn.item.id;
|
||||
// Set the character-set
|
||||
if (charset && !PrivateBrowsingUtils.isWindowPrivate(aBrowser.contentWindow))
|
||||
if (charset && !PrivateBrowsingUtils.isBrowserPrivate(aBrowser))
|
||||
PlacesUtils.setCharsetForURI(uri, charset);
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ let AboutHomeListener = {
|
||||
|
||||
onUpdate: function(aData) {
|
||||
let doc = content.document;
|
||||
if (aData.showRestoreLastSession && !PrivateBrowsingUtils.isWindowPrivate(content))
|
||||
if (aData.showRestoreLastSession && !PrivateBrowsingUtils.isContentWindowPrivate(content))
|
||||
doc.getElementById("launcher").setAttribute("session", "true");
|
||||
|
||||
// Inject search engine and snippets URL.
|
||||
|
@ -65,7 +65,7 @@ function test()
|
||||
info("private tab opened");
|
||||
privateBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
|
||||
privateContent = privateBrowser.selectedBrowser.contentWindow;
|
||||
ok(PrivateBrowsingUtils.isWindowPrivate(privateContent), "tab window is private");
|
||||
ok(PrivateBrowsingUtils.isBrowserPrivate(privateBrowser.selectedBrowser), "tab window is private");
|
||||
openConsole(privateTab, consoleOpened);
|
||||
}, true);
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ this.ContentSearch = {
|
||||
// been destroyed by the time we receive this message, and as a result
|
||||
// contentWindow is undefined.
|
||||
if (!msg.target.contentWindow ||
|
||||
PrivateBrowsingUtils.isWindowPrivate(msg.target.contentWindow)) {
|
||||
PrivateBrowsingUtils.isBrowserPrivate(msg.target)) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
let browserData = this._suggestionDataForBrowser(msg.target, true);
|
||||
|
@ -3,10 +3,10 @@
|
||||
<script>
|
||||
// Make sure that we cannot open private browsing windows from unprivileged content
|
||||
var win = window.open("about:blank", "_blank", "private");
|
||||
ok(!SpecialPowers.isWindowPrivate(win));
|
||||
ok(!SpecialPowers.isContentWindowPrivate(win));
|
||||
win.close();
|
||||
// Also, make sure that passing non-private doesn't make any difference either
|
||||
win = window.open("about:blank", "_blank", "non-private");
|
||||
ok(!SpecialPowers.isWindowPrivate(win));
|
||||
ok(!SpecialPowers.isContentWindowPrivate(win));
|
||||
win.close();
|
||||
</script>
|
||||
|
@ -44,7 +44,7 @@ var MemoryObserver = {
|
||||
// If this browser is already a zombie, fallback to the session data
|
||||
let currentURL = browser.__SS_restore ? data.entries[0].url : browser.currentURI.spec;
|
||||
let sibling = browser.nextSibling;
|
||||
let isPrivate = PrivateBrowsingUtils.isWindowPrivate(browser.contentWindow);
|
||||
let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(browser);
|
||||
|
||||
tab.destroy();
|
||||
tab.create(currentURL, { sibling: sibling, zombifying: true, delayLoad: true, isPrivate: isPrivate });
|
||||
|
@ -948,7 +948,7 @@ var SelectionHandler = {
|
||||
if (selectedText.length) {
|
||||
let req = Services.search.defaultEngine.getSubmission(selectedText);
|
||||
let parent = BrowserApp.selectedTab;
|
||||
let isPrivate = PrivateBrowsingUtils.isWindowPrivate(parent.browser.contentWindow);
|
||||
let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(parent.browser);
|
||||
// Set current tab as parent of new tab, and set new tab as private if the parent is.
|
||||
BrowserApp.addTab(req.uri.spec, {parentId: parent.id,
|
||||
selected: true,
|
||||
|
@ -1209,7 +1209,7 @@ var BrowserApp = {
|
||||
webBrowserPrint.cancel();
|
||||
}
|
||||
}
|
||||
let isPrivate = PrivateBrowsingUtils.isWindowPrivate(aBrowser.contentWindow);
|
||||
let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(aBrowser);
|
||||
let download = dm.addDownload(Ci.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
|
||||
aBrowser.currentURI,
|
||||
Services.io.newFileURI(file), "", mimeInfo,
|
||||
@ -1629,7 +1629,7 @@ var BrowserApp = {
|
||||
this.isSearch = true;
|
||||
|
||||
// Don't store queries in private browsing mode.
|
||||
let isPrivate = PrivateBrowsingUtils.isWindowPrivate(this.selectedTab.browser.contentWindow);
|
||||
let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.selectedTab.browser);
|
||||
let query = isPrivate ? "" : aData;
|
||||
|
||||
let engine = aSubject.QueryInterface(Ci.nsISearchEngine);
|
||||
@ -2108,7 +2108,7 @@ var NativeWindow = {
|
||||
linkOpenableNonPrivateContext: {
|
||||
matches: function linkOpenableNonPrivateContextMatches(aElement) {
|
||||
let doc = aElement.ownerDocument;
|
||||
if (!doc || PrivateBrowsingUtils.isWindowPrivate(doc.defaultView)) {
|
||||
if (!doc || PrivateBrowsingUtils.isContentWindowPrivate(doc.defaultView)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2979,7 +2979,7 @@ nsBrowserAccess.prototype = {
|
||||
let parent = BrowserApp.getTabForWindow(aOpener.top);
|
||||
if (parent) {
|
||||
parentId = parent.id;
|
||||
isPrivate = PrivateBrowsingUtils.isWindowPrivate(parent.browser.contentWindow);
|
||||
isPrivate = PrivateBrowsingUtils.isBrowserPrivate(parent.browser);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6347,7 +6347,7 @@ var PopupBlockerObserver = {
|
||||
let popupName = pageReport[i].popupWindowName;
|
||||
|
||||
let parent = BrowserApp.selectedTab;
|
||||
let isPrivate = PrivateBrowsingUtils.isWindowPrivate(parent.browser.contentWindow);
|
||||
let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(parent.browser);
|
||||
BrowserApp.addTab(popupURIspec, { parentId: parent.id, isPrivate: isPrivate });
|
||||
}
|
||||
}
|
||||
|
@ -930,7 +930,7 @@ SessionStore.prototype = {
|
||||
throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
|
||||
|
||||
let closedTabs = this._windows[aWindow.__SSID].closedTabs;
|
||||
let isPrivate = PrivateBrowsingUtils.isWindowPrivate(aWindow.BrowserApp.selectedBrowser.contentWindow);
|
||||
let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(aWindow.BrowserApp.selectedBrowser);
|
||||
|
||||
let tabs = closedTabs
|
||||
.filter(tab => tab.isPrivate == isPrivate)
|
||||
|
@ -318,8 +318,8 @@ TabTracker.prototype = {
|
||||
|
||||
onTab: function onTab(event) {
|
||||
if (event.originalTarget.linkedBrowser) {
|
||||
let win = event.originalTarget.linkedBrowser.contentWindow;
|
||||
if (PrivateBrowsingUtils.isWindowPrivate(win) &&
|
||||
let browser = event.originalTarget.linkedBrowser;
|
||||
if (PrivateBrowsingUtils.isBrowserPrivate(browser) &&
|
||||
!PrivateBrowsingUtils.permanentPrivateBrowsing) {
|
||||
this._log.trace("Ignoring tab event from private browsing.");
|
||||
return;
|
||||
|
@ -1803,8 +1803,8 @@ SpecialPowersAPI.prototype = {
|
||||
return file.mozFullPath;
|
||||
},
|
||||
|
||||
isWindowPrivate: function(win) {
|
||||
return PrivateBrowsingUtils.isWindowPrivate(win);
|
||||
isContentWindowPrivate: function(win) {
|
||||
return PrivateBrowsingUtils.isContentWindowPrivate(win);
|
||||
},
|
||||
|
||||
notifyObserversInParentProcess: function(subject, topic, data) {
|
||||
|
@ -248,7 +248,7 @@ var LoginManagerContent = {
|
||||
|
||||
loginsFound: function({ form, loginsFound }) {
|
||||
let doc = form.ownerDocument;
|
||||
let autofillForm = gAutofillForms && !PrivateBrowsingUtils.isWindowPrivate(doc.defaultView);
|
||||
let autofillForm = gAutofillForms && !PrivateBrowsingUtils.isContentWindowPrivate(doc.defaultView);
|
||||
|
||||
this._fillForm(form, autofillForm, false, false, false, loginsFound);
|
||||
},
|
||||
@ -481,7 +481,7 @@ var LoginManagerContent = {
|
||||
var doc = form.ownerDocument;
|
||||
var win = doc.defaultView;
|
||||
|
||||
if (PrivateBrowsingUtils.isWindowPrivate(win)) {
|
||||
if (PrivateBrowsingUtils.isContentWindowPrivate(win)) {
|
||||
// We won't do anything in private browsing mode anyway,
|
||||
// so there's no need to perform further checks.
|
||||
log("(form submission ignored in private browsing mode)");
|
||||
|
@ -253,7 +253,7 @@ LoginManagerPrompter.prototype = {
|
||||
// Whether we are in private browsing mode
|
||||
get _inPrivateBrowsing() {
|
||||
if (this._window) {
|
||||
return PrivateBrowsingUtils.isWindowPrivate(this._window);
|
||||
return PrivateBrowsingUtils.isContentWindowPrivate(this._window);
|
||||
} else {
|
||||
// If we don't that we're in private browsing mode if the caller did
|
||||
// not provide a window. The callers which really care about this
|
||||
|
@ -104,7 +104,7 @@ var satchelFormListener = {
|
||||
if (!this.enabled)
|
||||
return;
|
||||
|
||||
if (PrivateBrowsingUtils.isWindowPrivate(domWin))
|
||||
if (PrivateBrowsingUtils.isContentWindowPrivate(domWin))
|
||||
return;
|
||||
|
||||
this.log("Form submit observer notified.");
|
||||
|
@ -19,6 +19,17 @@ this.PrivateBrowsingUtils = {
|
||||
// Rather than passing content windows to this function, please use
|
||||
// isBrowserPrivate since it works with e10s.
|
||||
isWindowPrivate: function pbu_isWindowPrivate(aWindow) {
|
||||
if (!(aWindow instanceof Components.interfaces.nsIDOMChromeWindow)) {
|
||||
dump("WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. " +
|
||||
"Use isContentWindowPrivate instead (but only for frame scripts).\n"
|
||||
+ new Error().stack);
|
||||
}
|
||||
|
||||
return this.privacyContextFromWindow(aWindow).usePrivateBrowsing;
|
||||
},
|
||||
|
||||
// This should be used only in frame scripts.
|
||||
isContentWindowPrivate: function pbu_isWindowPrivate(aWindow) {
|
||||
return this.privacyContextFromWindow(aWindow).usePrivateBrowsing;
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user