Bug 806720 - Rewrite the browser_styleeditor_private_perwindow.js test according to the latest changes to the style editor test suite; shoulder-r=jdm

DONTBUILD since this is NPOTB for global PB builds
This commit is contained in:
Ehsan Akhgari 2012-12-02 19:21:43 -05:00
Родитель 1157a9ee2f
Коммит fbef18ef91
2 изменённых файлов: 27 добавлений и 29 удалений

Просмотреть файл

@ -19,23 +19,31 @@ function test() {
aWindow.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
cache.evictEntries(Ci.nsICache.STORE_ANYWHERE);
launchStyleEditorChromeFromWindow(aWindow, function(aChrome) {
aChrome.addChromeListener({
onEditorAdded: function(aChrome, aEditor) {
if (aEditor.isLoaded) {
checkCache();
} else {
aEditor.addActionListener({
onLoad: checkCache
});
}
}
});
if (aChrome.isContentAttached) {
onEditorAdded(aChrome, aChrome.editors[0]);
} else {
aChrome.addChromeListener({
onEditorAdded: onEditorAdded
});
}
});
}, true);
aWindow.gBrowser.selectedBrowser.loadURI(testURI);
}
function onEditorAdded(aChrome, aEditor) {
aChrome.removeChromeListener(this);
if (aEditor.isLoaded) {
checkCache();
} else {
aEditor.addActionListener({
onLoad: checkCache
});
}
}
function testOnWindow(options, callback) {
let win = OpenBrowserWindow(options);
win.addEventListener("load", function onLoad() {

Просмотреть файл

@ -29,9 +29,14 @@ function cleanup()
function launchStyleEditorChrome(aCallback, aSheet, aLine, aCol)
{
let target = TargetFactory.forTab(gBrowser.selectedTab);
launchStyleEditorChromeFromWindow(window, aCallback, aSheet, aLine, aCol);
}
let panel = gDevTools.getPanelForTarget("styleeditor", target);
function launchStyleEditorChromeFromWindow(aWindow, aCallback, aSheet, aLine, aCol)
{
let target = TargetFactory.forTab(aWindow.gBrowser.selectedTab);
let panel = aWindow.gDevTools.getPanelForTarget("styleeditor", target);
if (panel && panel.isReady) {
gChromeWindow = panel._panelWin;
gChromeWindow.styleEditorChrome._alwaysDisableAnimations = true;
@ -40,7 +45,7 @@ function launchStyleEditorChrome(aCallback, aSheet, aLine, aCol)
}
aCallback(gChromeWindow.styleEditorChrome);
} else {
let toolbox = gDevTools.openToolboxForTab(target, "styleeditor");
let toolbox = aWindow.gDevTools.openToolboxForTab(target, "styleeditor");
toolbox.once("styleeditor-ready", function(event, panel) {
gChromeWindow = panel._panelWin;
gChromeWindow.styleEditorChrome._alwaysDisableAnimations = true;
@ -52,21 +57,6 @@ function launchStyleEditorChrome(aCallback, aSheet, aLine, aCol)
}
}
function launchStyleEditorChromeFromWindow(aWindow, aCallback, aSheet, aLine, aCol)
{
gChromeWindow = aWindow.StyleEditor.openChrome(aSheet, aLine, aCol);
if (gChromeWindow.document.readyState != "complete") {
gChromeWindow.addEventListener("load", function onChromeLoad() {
gChromeWindow.removeEventListener("load", onChromeLoad, true);
gChromeWindow.styleEditorChrome._alwaysDisableAnimations = true;
aCallback(gChromeWindow.styleEditorChrome);
}, true);
} else {
gChromeWindow.styleEditorChrome._alwaysDisableAnimations = true;
aCallback(gChromeWindow.styleEditorChrome);
}
}
function addTabAndLaunchStyleEditorChromeWhenLoaded(aCallback, aSheet, aLine, aCol)
{
gBrowser.selectedTab = gBrowser.addTab();