2011-10-26 02:52:17 -07:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
const TEST_BASE = "chrome://mochitests/content/browser/browser/devtools/styleeditor/test/";
|
|
|
|
const TEST_BASE_HTTP = "http://example.com/browser/browser/devtools/styleeditor/test/";
|
|
|
|
const TEST_BASE_HTTPS = "https://example.com/browser/browser/devtools/styleeditor/test/";
|
2012-11-12 17:42:47 -08:00
|
|
|
const TEST_HOST = 'mochi.test:8888';
|
2011-10-26 02:52:17 -07:00
|
|
|
|
2012-11-30 00:07:59 -08:00
|
|
|
let tempScope = {};
|
2013-05-01 09:27:24 -07:00
|
|
|
Cu.import("resource://gre/modules/devtools/Loader.jsm", tempScope);
|
2013-04-11 13:59:08 -07:00
|
|
|
let TargetFactory = tempScope.devtools.TargetFactory;
|
2012-12-16 23:29:04 -08:00
|
|
|
Components.utils.import("resource://gre/modules/devtools/Console.jsm", tempScope);
|
2012-12-13 05:03:55 -08:00
|
|
|
let console = tempScope.console;
|
2012-11-30 00:07:59 -08:00
|
|
|
|
2013-04-25 09:46:13 -07:00
|
|
|
let gPanelWindow;
|
2012-11-12 17:42:47 -08:00
|
|
|
let cache = Cc["@mozilla.org/network/cache-service;1"]
|
|
|
|
.getService(Ci.nsICacheService);
|
|
|
|
|
2011-10-26 02:52:17 -07:00
|
|
|
|
2012-08-14 07:51:48 -07:00
|
|
|
// Import the GCLI test helper
|
|
|
|
let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
|
2013-05-25 01:51:31 -07:00
|
|
|
Services.scriptloader.loadSubScript(testDir + "../../../commandline/test/helpers.js", this);
|
2012-08-14 07:51:48 -07:00
|
|
|
|
2011-10-26 02:52:17 -07:00
|
|
|
function cleanup()
|
|
|
|
{
|
2013-04-25 09:46:13 -07:00
|
|
|
gPanelWindow = null;
|
2011-10-26 02:52:17 -07:00
|
|
|
while (gBrowser.tabs.length > 1) {
|
|
|
|
gBrowser.removeCurrentTab();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-25 09:46:13 -07:00
|
|
|
function addTabAndOpenStyleEditor(callback) {
|
|
|
|
gBrowser.selectedTab = gBrowser.addTab();
|
|
|
|
gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
|
|
|
|
gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
|
|
|
|
openStyleEditorInWindow(window, callback);
|
|
|
|
}, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
function openStyleEditorInWindow(win, callback) {
|
|
|
|
let target = TargetFactory.forTab(win.gBrowser.selectedTab);
|
|
|
|
win.gDevTools.showToolbox(target, "styleeditor").then(function(toolbox) {
|
|
|
|
let panel = toolbox.getCurrentPanel();
|
|
|
|
gPanelWindow = panel._panelWin;
|
|
|
|
|
|
|
|
panel.UI._alwaysDisableAnimations = true;
|
|
|
|
|
|
|
|
/*
|
|
|
|
if (aSheet) {
|
|
|
|
panel.selectStyleSheet(aSheet, aLine, aCol);
|
|
|
|
} */
|
|
|
|
|
|
|
|
callback(panel);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-02-10 05:39:47 -08:00
|
|
|
function launchStyleEditorChrome(aCallback, aSheet, aLine, aCol)
|
2011-10-26 02:52:17 -07:00
|
|
|
{
|
2012-12-02 16:21:43 -08:00
|
|
|
launchStyleEditorChromeFromWindow(window, aCallback, aSheet, aLine, aCol);
|
|
|
|
}
|
|
|
|
|
|
|
|
function launchStyleEditorChromeFromWindow(aWindow, aCallback, aSheet, aLine, aCol)
|
|
|
|
{
|
|
|
|
let target = TargetFactory.forTab(aWindow.gBrowser.selectedTab);
|
2012-12-13 05:03:55 -08:00
|
|
|
gDevTools.showToolbox(target, "styleeditor").then(function(toolbox) {
|
|
|
|
let panel = toolbox.getCurrentPanel();
|
2013-04-25 09:46:13 -07:00
|
|
|
gPanelWindow = panel._panelWin;
|
|
|
|
gPanelWindow.styleEditorChrome._alwaysDisableAnimations = true;
|
2012-11-30 00:07:59 -08:00
|
|
|
if (aSheet) {
|
|
|
|
panel.selectStyleSheet(aSheet, aLine, aCol);
|
|
|
|
}
|
2013-04-25 09:46:13 -07:00
|
|
|
aCallback(gPanelWindow.styleEditorChrome);
|
2012-12-13 05:03:55 -08:00
|
|
|
});
|
2011-10-26 02:52:17 -07:00
|
|
|
}
|
|
|
|
|
2012-02-10 05:39:47 -08:00
|
|
|
function addTabAndLaunchStyleEditorChromeWhenLoaded(aCallback, aSheet, aLine, aCol)
|
2011-10-26 02:52:17 -07:00
|
|
|
{
|
|
|
|
gBrowser.selectedTab = gBrowser.addTab();
|
|
|
|
gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
|
|
|
|
gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
|
2012-02-10 05:39:47 -08:00
|
|
|
launchStyleEditorChrome(aCallback, aSheet, aLine, aCol);
|
2011-10-26 02:52:17 -07:00
|
|
|
}, true);
|
|
|
|
}
|
2013-04-25 09:46:13 -07:00
|
|
|
*/
|
2011-10-26 02:52:17 -07:00
|
|
|
|
2012-11-12 17:42:47 -08:00
|
|
|
function checkDiskCacheFor(host)
|
|
|
|
{
|
|
|
|
let foundPrivateData = false;
|
|
|
|
|
|
|
|
let visitor = {
|
|
|
|
visitDevice: function(deviceID, deviceInfo) {
|
|
|
|
if (deviceID == "disk")
|
|
|
|
info("disk device contains " + deviceInfo.entryCount + " entries");
|
|
|
|
return deviceID == "disk";
|
|
|
|
},
|
|
|
|
|
|
|
|
visitEntry: function(deviceID, entryInfo) {
|
|
|
|
info(entryInfo.key);
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
2011-10-26 02:52:17 -07:00
|
|
|
registerCleanupFunction(cleanup);
|