michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: // This test makes sure that the style editor does not store any michael@0: // content CSS files in the permanent cache when opened from PB mode. michael@0: michael@0: let gUI; michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: let windowsToClose = []; michael@0: let testURI = 'http://' + TEST_HOST + '/browser/browser/devtools/styleeditor/test/test_private.html'; michael@0: michael@0: function checkCache() { michael@0: checkDiskCacheFor(TEST_HOST, function() { michael@0: gUI = null; michael@0: finish(); michael@0: }); michael@0: } michael@0: michael@0: function doTest(aWindow) { michael@0: aWindow.gBrowser.selectedBrowser.addEventListener("load", function onLoad() { michael@0: aWindow.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); michael@0: cache.clear(); michael@0: openStyleEditorInWindow(aWindow, function(panel) { michael@0: gUI = panel.UI; michael@0: gUI.on("editor-added", onEditorAdded); michael@0: }); michael@0: }, true); michael@0: michael@0: aWindow.gBrowser.selectedBrowser.loadURI(testURI); michael@0: } michael@0: michael@0: function onEditorAdded(aEvent, aEditor) { michael@0: aEditor.getSourceEditor().then(checkCache); michael@0: } michael@0: michael@0: function testOnWindow(options, callback) { michael@0: let win = OpenBrowserWindow(options); michael@0: win.addEventListener("load", function onLoad() { michael@0: win.removeEventListener("load", onLoad, false); michael@0: windowsToClose.push(win); michael@0: executeSoon(function() callback(win)); michael@0: }, false); michael@0: }; michael@0: michael@0: registerCleanupFunction(function() { michael@0: windowsToClose.forEach(function(win) { michael@0: win.close(); michael@0: }); michael@0: }); michael@0: michael@0: testOnWindow({private: true}, function(win) { michael@0: doTest(win); michael@0: }); michael@0: }