Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 // This test makes sure that the style editor does not store any
6 // content CSS files in the permanent cache when opened from PB mode.
8 let gUI;
10 function test() {
11 waitForExplicitFinish();
12 let windowsToClose = [];
13 let testURI = 'http://' + TEST_HOST + '/browser/browser/devtools/styleeditor/test/test_private.html';
15 function checkCache() {
16 checkDiskCacheFor(TEST_HOST, function() {
17 gUI = null;
18 finish();
19 });
20 }
22 function doTest(aWindow) {
23 aWindow.gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
24 aWindow.gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
25 cache.clear();
26 openStyleEditorInWindow(aWindow, function(panel) {
27 gUI = panel.UI;
28 gUI.on("editor-added", onEditorAdded);
29 });
30 }, true);
32 aWindow.gBrowser.selectedBrowser.loadURI(testURI);
33 }
35 function onEditorAdded(aEvent, aEditor) {
36 aEditor.getSourceEditor().then(checkCache);
37 }
39 function testOnWindow(options, callback) {
40 let win = OpenBrowserWindow(options);
41 win.addEventListener("load", function onLoad() {
42 win.removeEventListener("load", onLoad, false);
43 windowsToClose.push(win);
44 executeSoon(function() callback(win));
45 }, false);
46 };
48 registerCleanupFunction(function() {
49 windowsToClose.forEach(function(win) {
50 win.close();
51 });
52 });
54 testOnWindow({private: true}, function(win) {
55 doTest(win);
56 });
57 }