mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 792528 - Make the channel created to fetch CSS files for editing respect the privacy status of the originating document. r=dcamp
This commit is contained in:
parent
a14d918dad
commit
346c033518
@ -909,6 +909,13 @@ StyleEditor.prototype = {
|
||||
}.bind(this)
|
||||
};
|
||||
|
||||
if (channel instanceof Ci.nsIPrivateBrowsingChannel) {
|
||||
let contentWin = this.contentDocument.defaultView;
|
||||
let loadContext = contentWin.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsILoadContext);
|
||||
channel.setPrivate(loadContext.usePrivateBrowsing);
|
||||
}
|
||||
channel.loadFlags = channel.LOAD_FROM_CACHE;
|
||||
channel.asyncOpen(streamListener, null);
|
||||
},
|
||||
|
@ -22,6 +22,7 @@ _BROWSER_TEST_FILES = \
|
||||
browser_styleeditor_new.js \
|
||||
browser_styleeditor_passedinsheet.js \
|
||||
browser_styleeditor_pretty.js \
|
||||
browser_styleeditor_private.js \
|
||||
browser_styleeditor_readonly.js \
|
||||
browser_styleeditor_reopen.js \
|
||||
browser_styleeditor_sv_keynav.js \
|
||||
@ -40,6 +41,8 @@ _BROWSER_TEST_FILES = \
|
||||
simple.css.gz^headers^ \
|
||||
simple.gz.html \
|
||||
simple.html \
|
||||
test_private.html \
|
||||
test_private.css \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_BROWSER_TEST_FILES)
|
||||
|
@ -0,0 +1,63 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// This test makes sure that the style editor does not store any
|
||||
// content CSS files in the permanent cache when opened from PB mode.
|
||||
|
||||
function checkDiskCacheFor(host) {
|
||||
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);
|
||||
is(entryInfo.key.contains(host), false, "web content present in disk cache");
|
||||
}
|
||||
};
|
||||
cache.visitEntries(visitor);
|
||||
}
|
||||
|
||||
const TEST_HOST = 'mochi.test:8888';
|
||||
|
||||
var cache = Cc["@mozilla.org/network/cache-service;1"]
|
||||
.getService(Ci.nsICacheService);
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gPrefService.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
||||
let pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
pb.privateBrowsingEnabled = true;
|
||||
|
||||
function checkCache() {
|
||||
checkDiskCacheFor(TEST_HOST);
|
||||
pb.privateBrowsingEnabled = false;
|
||||
gPrefService.clearUserPref("browser.privatebrowsing.keep_current_session");
|
||||
finish();
|
||||
}
|
||||
|
||||
gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
|
||||
cache.evictEntries(Ci.nsICache.STORE_ANYWHERE);
|
||||
launchStyleEditorChrome(function(aChrome) {
|
||||
aChrome.addChromeListener({
|
||||
onEditorAdded: function(aChrome, aEditor) {
|
||||
if (aEditor.isLoaded) {
|
||||
checkCache();
|
||||
} else {
|
||||
aEditor.addActionListener({
|
||||
onLoad: checkCache
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}, true);
|
||||
|
||||
content.location = 'http://' + TEST_HOST + '/browser/browser/devtools/styleeditor/test/test_private.html';
|
||||
}
|
3
browser/devtools/styleeditor/test/test_private.css
Normal file
3
browser/devtools/styleeditor/test/test_private.css
Normal file
@ -0,0 +1,3 @@
|
||||
body {
|
||||
background-color: red;
|
||||
}
|
7
browser/devtools/styleeditor/test/test_private.html
Normal file
7
browser/devtools/styleeditor/test/test_private.html
Normal file
@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="test_private.css"></link>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user