mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 806722 - Port indexedDB browser_privateBrowsing.js to the new per-tab PB APIs; r=jdm
--HG-- rename : dom/indexedDB/test/browser_privateBrowsing.js => dom/indexedDB/test/browser_perwindow_privateBrowsing.js
This commit is contained in:
parent
c28a4531fd
commit
1c2b6fe0b3
@ -123,7 +123,6 @@ MOCHITEST_BROWSER_FILES = \
|
||||
browser_permissionsPrompt.html \
|
||||
browser_permissionsPromptAllow.js \
|
||||
browser_permissionsPromptDeny.js \
|
||||
browser_privateBrowsing.js \
|
||||
browser_quotaPrompt.html \
|
||||
browser_quotaPromptAllow.js \
|
||||
browser_quotaPromptDeny.js \
|
||||
@ -133,6 +132,17 @@ MOCHITEST_BROWSER_FILES = \
|
||||
browser_quotaPromptDelete.js \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
|
||||
MOCHITEST_BROWSER_FILES += \
|
||||
browser_perwindow_privateBrowsing.js \
|
||||
$(NULL)
|
||||
else
|
||||
MOCHITEST_BROWSER_FILES += \
|
||||
browser_privateBrowsing.js \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
59
dom/indexedDB/test/browser_perwindow_privateBrowsing.js
Normal file
59
dom/indexedDB/test/browser_perwindow_privateBrowsing.js
Normal file
@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
const testPageURL = "http://mochi.test:8888/browser/" +
|
||||
"dom/indexedDB/test/browser_permissionsPrompt.html";
|
||||
const notificationID = "indexedDB-permissions-prompt";
|
||||
|
||||
function test()
|
||||
{
|
||||
waitForExplicitFinish();
|
||||
executeSoon(test1);
|
||||
}
|
||||
|
||||
function test1()
|
||||
{
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function () {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
setFinishedCallback(function(result, exception) {
|
||||
ok(result instanceof Components.interfaces.nsIIDBDatabase,
|
||||
"First database creation was successful");
|
||||
ok(!exception, "No exception");
|
||||
gBrowser.removeCurrentTab();
|
||||
|
||||
executeSoon(test2);
|
||||
});
|
||||
}, true);
|
||||
content.location = testPageURL;
|
||||
}
|
||||
|
||||
function test2()
|
||||
{
|
||||
var win = OpenBrowserWindow({private: true});
|
||||
win.addEventListener("load", function onLoad() {
|
||||
win.removeEventListener("load", onLoad, false);
|
||||
executeSoon(function() test3(win));
|
||||
}, false);
|
||||
registerCleanupFunction(function() win.close());
|
||||
}
|
||||
|
||||
function test3(win)
|
||||
{
|
||||
win.gBrowser.selectedTab = win.gBrowser.addTab();
|
||||
win.gBrowser.selectedBrowser.addEventListener("load", function () {
|
||||
win.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
setFinishedCallback(function(result, exception) {
|
||||
ok(!result, "No database");
|
||||
is(exception, "InvalidStateError", "Correct exception");
|
||||
win.gBrowser.removeCurrentTab();
|
||||
|
||||
executeSoon(finish);
|
||||
}, win);
|
||||
}, true);
|
||||
win.content.location = testPageURL;
|
||||
}
|
@ -87,9 +87,12 @@ function dismissNotification(popup)
|
||||
});
|
||||
}
|
||||
|
||||
function setFinishedCallback(callback)
|
||||
function setFinishedCallback(callback, win)
|
||||
{
|
||||
let testPage = gBrowser.selectedBrowser.contentWindow.wrappedJSObject;
|
||||
if (!win) {
|
||||
win = window;
|
||||
}
|
||||
let testPage = win.gBrowser.selectedBrowser.contentWindow.wrappedJSObject;
|
||||
testPage.testFinishedCallback = function(result, exception) {
|
||||
setTimeout(function() {
|
||||
info("got finished callback");
|
||||
|
Loading…
Reference in New Issue
Block a user