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;
|
2013-09-20 02:11:25 -07:00
|
|
|
Cu.import("resource://gre/modules/LoadContextInfo.jsm", tempScope);
|
|
|
|
let LoadContextInfo = tempScope.LoadContextInfo;
|
|
|
|
Cu.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;
|
2013-09-20 02:11:25 -07:00
|
|
|
let cache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
|
|
|
|
.getService(Ci.nsICacheStorageService);
|
2012-11-12 17:42:47 -08:00
|
|
|
|
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;
|
|
|
|
callback(panel);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2013-09-20 02:11:25 -07:00
|
|
|
function checkDiskCacheFor(host, done)
|
2012-11-12 17:42:47 -08:00
|
|
|
{
|
|
|
|
let foundPrivateData = false;
|
|
|
|
|
2013-09-20 02:11:25 -07:00
|
|
|
Visitor.prototype = {
|
|
|
|
onCacheStorageInfo: function(num, consumption)
|
|
|
|
{
|
|
|
|
info("disk storage contains " + num + " entries");
|
2012-11-12 17:42:47 -08:00
|
|
|
},
|
2013-09-20 02:11:25 -07:00
|
|
|
onCacheEntryInfo: function(entry)
|
|
|
|
{
|
|
|
|
info(entry.key);
|
|
|
|
foundPrivateData |= entry.key.contains(host);
|
|
|
|
},
|
|
|
|
onCacheEntryVisitCompleted: function()
|
|
|
|
{
|
2012-11-12 17:42:47 -08:00
|
|
|
is(foundPrivateData, false, "web content present in disk cache");
|
2013-09-20 02:11:25 -07:00
|
|
|
done();
|
2012-11-12 17:42:47 -08:00
|
|
|
}
|
|
|
|
};
|
2013-09-20 02:11:25 -07:00
|
|
|
function Visitor() {}
|
|
|
|
|
|
|
|
var storage = cache.diskCacheStorage(LoadContextInfo.default, false);
|
|
|
|
storage.asyncVisitStorage(new Visitor(), true /* Do walk entries */);
|
2012-11-12 17:42:47 -08:00
|
|
|
}
|
|
|
|
|
2011-10-26 02:52:17 -07:00
|
|
|
registerCleanupFunction(cleanup);
|