зеркало из https://github.com/mozilla/gecko-dev.git
Bug 811490 - Convert services/sync/tests/tps/test_privbrw_tabs.js to PB per window mode; r=ehsan,rnewman
--HG-- extra : rebase_source : 84ba6b5df17aecc78569596fbc02d19fec312b00
This commit is contained in:
Родитель
09155dbef7
Коммит
97b57987ba
|
@ -58,7 +58,6 @@ var tabs3 = [
|
|||
}
|
||||
];
|
||||
|
||||
|
||||
/*
|
||||
* Test phases
|
||||
*/
|
||||
|
@ -77,7 +76,7 @@ Phase('phase2', [
|
|||
|
||||
Phase('phase3', [
|
||||
[Sync],
|
||||
[SetPrivateBrowsing, true],
|
||||
[Windows.add, { private: true }],
|
||||
[Tabs.add, tabs3],
|
||||
[Sync]
|
||||
]);
|
||||
|
@ -86,4 +85,3 @@ Phase('phase4', [
|
|||
[Sync],
|
||||
[Tabs.verifyNot, tabs3]
|
||||
]);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ CU.import("resource://tps/history.jsm");
|
|||
CU.import("resource://tps/forms.jsm");
|
||||
CU.import("resource://tps/prefs.jsm");
|
||||
CU.import("resource://tps/tabs.jsm");
|
||||
CU.import("resource://tps/windows.jsm");
|
||||
|
||||
var hh = CC["@mozilla.org/network/protocol;1?name=http"]
|
||||
.getService(CI.nsIHttpProtocolHandler);
|
||||
|
@ -163,6 +164,20 @@ let TPS = {
|
|||
this.goQuitApplication();
|
||||
},
|
||||
|
||||
HandleWindows: function (aWindow, action) {
|
||||
Logger.logInfo("executing action " + action.toUpperCase() +
|
||||
" on window " + JSON.stringify(aWindow));
|
||||
switch(action) {
|
||||
case ACTION_ADD:
|
||||
BrowserWindows.Add(aWindow.private, function(win) {
|
||||
Logger.logInfo("window finished loading");
|
||||
this.FinishAsyncOperation();
|
||||
}.bind(this));
|
||||
break;
|
||||
}
|
||||
Logger.logPass("executing action " + action.toUpperCase() + " on windows");
|
||||
},
|
||||
|
||||
HandleTabs: function (tabs, action) {
|
||||
this._tabsAdded = tabs.length;
|
||||
this._tabsFinished = 0;
|
||||
|
@ -927,3 +942,9 @@ var Tabs = {
|
|||
}
|
||||
};
|
||||
|
||||
var Windows = {
|
||||
add: function Window__add(aWindow) {
|
||||
TPS.StartAsyncOperation();
|
||||
TPS.HandleWindows(aWindow, ACTION_ADD);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
/* This is a JavaScript module (JSM) to be imported via
|
||||
Components.utils.import() and acts as a singleton.
|
||||
Only the following listed symbols will exposed on import, and only when
|
||||
and where imported. */
|
||||
|
||||
const EXPORTED_SYMBOLS = ["BrowserWindows"];
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://services-sync/main.js");
|
||||
|
||||
let BrowserWindows = {
|
||||
/**
|
||||
* Add
|
||||
*
|
||||
* Opens a new window. Throws on error.
|
||||
*
|
||||
* @param aPrivate The private option.
|
||||
* @return nothing
|
||||
*/
|
||||
Add: function(aPrivate, fn) {
|
||||
let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Ci.nsIWindowMediator);
|
||||
let mainWindow = wm.getMostRecentWindow("navigator:browser");
|
||||
let win = mainWindow.OpenBrowserWindow({private: aPrivate});
|
||||
win.addEventListener("load", function onLoad() {
|
||||
win.removeEventListener("load", onLoad, false);
|
||||
fn.call(win);
|
||||
}, false);
|
||||
}
|
||||
};
|
Загрузка…
Ссылка в новой задаче