mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 798508 - Part 2: Add a browser-level API for opening new Private Browsing windows; r=jdm
This is currently hidden behind the per-window PB build option.
This commit is contained in:
parent
b156d1d1a0
commit
34be82dd09
@ -3498,7 +3498,7 @@ function toOpenWindowByType(inType, uri, features)
|
||||
window.open(uri, "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar");
|
||||
}
|
||||
|
||||
function OpenBrowserWindow()
|
||||
function OpenBrowserWindow(options)
|
||||
{
|
||||
var telemetryObj = {};
|
||||
TelemetryStopwatch.start("FX_NEW_WINDOW_MS", telemetryObj);
|
||||
@ -3519,6 +3519,15 @@ function OpenBrowserWindow()
|
||||
var defaultArgs = handler.defaultArgs;
|
||||
var wintype = document.documentElement.getAttribute('windowtype');
|
||||
|
||||
var extraFeatures = "";
|
||||
#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
|
||||
if (typeof options == "object" &&
|
||||
"private" in options &&
|
||||
options.private) {
|
||||
extraFeatures = ",private";
|
||||
}
|
||||
#endif
|
||||
|
||||
// if and only if the current window is a browser window and it has a document with a character
|
||||
// set, then extract the current charset menu setting from the current document and use it to
|
||||
// initialize the new browser window...
|
||||
@ -3529,11 +3538,11 @@ function OpenBrowserWindow()
|
||||
charsetArg = "charset="+DocCharset;
|
||||
|
||||
//we should "inherit" the charset menu setting in a new window
|
||||
win = window.openDialog("chrome://browser/content/", "_blank", "chrome,all,dialog=no", defaultArgs, charsetArg);
|
||||
win = window.openDialog("chrome://browser/content/", "_blank", "chrome,all,dialog=no" + extraFeatures, defaultArgs, charsetArg);
|
||||
}
|
||||
else // forget about the charset information.
|
||||
{
|
||||
win = window.openDialog("chrome://browser/content/", "_blank", "chrome,all,dialog=no", defaultArgs);
|
||||
win = window.openDialog("chrome://browser/content/", "_blank", "chrome,all,dialog=no" + extraFeatures, defaultArgs);
|
||||
}
|
||||
|
||||
return win;
|
||||
|
@ -296,6 +296,12 @@ _BROWSER_FILES += \
|
||||
|
||||
endif
|
||||
|
||||
ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
|
||||
_BROWSER_FILES += \
|
||||
browser_private_browsing_window.js \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
libs:: $(_BROWSER_FILES)
|
||||
|
11
browser/base/content/test/browser_private_browsing_window.js
Normal file
11
browser/base/content/test/browser_private_browsing_window.js
Normal file
@ -0,0 +1,11 @@
|
||||
// Make sure that we can open private browsing windows
|
||||
|
||||
function test() {
|
||||
var nonPrivateWin = OpenBrowserWindow();
|
||||
ok(!PrivateBrowsingUtils.isWindowPrivate(nonPrivateWin), "OpenBrowserWindow() should open a normal window");
|
||||
nonPrivateWin.close();
|
||||
var privateWin = OpenBrowserWindow({private: true});
|
||||
ok(PrivateBrowsingUtils.isWindowPrivate(privateWin), "OpenBrowserWindow({private: true}) should open a private window");
|
||||
privateWin.close();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user