Bug 795556 - Part 1: Make Style Editor open with sensible parent window. r=jwalker

This commit is contained in:
Josh Matthews 2012-10-10 11:27:39 -04:00
parent 20ab557d2c
commit fcc3cdf03f
3 changed files with 12 additions and 7 deletions

View File

@ -7523,14 +7523,14 @@ var StyleEditor = {
this.StyleEditorManager.selectEditor(win);
return win;
} else {
return this.StyleEditorManager.newEditor(contentWindow,
return this.StyleEditorManager.newEditor(contentWindow, window,
aSelectedStyleSheet, aLine, aCol);
}
},
toggle: function SE_toggle()
{
this.StyleEditorManager.toggleEditor(gBrowser.contentWindow);
this.StyleEditorManager.toggleEditor(gBrowser.contentWindow, window);
}
};

View File

@ -1315,11 +1315,12 @@ StyleEditorManager.prototype = {
* Open a new editor.
*
* @param {Window} content window.
* @param {Window} chrome window.
* @param {CSSStyleSheet} [aSelectedStyleSheet] default Stylesheet.
* @param {Number} [aLine] Line to which the caret should be moved (one-indexed).
* @param {Number} [aCol] Column to which the caret should be moved (one-indexed).
*/
newEditor: function SEM_newEditor(aContentWindow, aSelectedStyleSheet, aLine, aCol) {
newEditor: function SEM_newEditor(aContentWindow, aChromeWindow, aSelectedStyleSheet, aLine, aCol) {
const CHROME_URL = "chrome://browser/content/styleeditor.xul";
const CHROME_WINDOW_FLAGS = "chrome,centerscreen,resizable,dialog=no";
@ -1330,7 +1331,7 @@ StyleEditorManager.prototype = {
col: aCol
};
args.wrappedJSObject = args;
let chromeWindow = Services.ww.openWindow(null, CHROME_URL, "_blank",
let chromeWindow = Services.ww.openWindow(aChromeWindow, CHROME_URL, "_blank",
CHROME_WINDOW_FLAGS, args);
chromeWindow.onunload = function() {
@ -1353,12 +1354,12 @@ StyleEditorManager.prototype = {
*
* @param {Window} associated content window.
*/
toggleEditor: function SEM_toggleEditor(aContentWindow) {
toggleEditor: function SEM_toggleEditor(aContentWindow, aChromeWindow) {
let editor = this.getEditorForWindow(aContentWindow);
if (editor) {
editor.close();
} else {
this.newEditor(aContentWindow);
this.newEditor(aContentWindow, aChromeWindow);
}
},

View File

@ -6,6 +6,8 @@
// content CSS files in the permanent cache when opened from PB mode.
function checkDiskCacheFor(host) {
let foundPrivateData = false;
let visitor = {
visitDevice: function(deviceID, deviceInfo) {
if (deviceID == "disk")
@ -15,10 +17,12 @@ function checkDiskCacheFor(host) {
visitEntry: function(deviceID, entryInfo) {
info(entryInfo.key);
is(entryInfo.key.contains(host), false, "web content present in disk cache");
foundPrivateData |= entryInfo.key.contains(host);
is(foundPrivateData, false, "web content present in disk cache");
}
};
cache.visitEntries(visitor);
is(foundPrivateData, false, "private data present in disk cache");
}
const TEST_HOST = 'mochi.test:8888';