mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1358070 - register dedicated privileged image for browser_docshell_type_editor.js;r=Gijs
The test image/test/browser/browser_docshell_type_editor.js used to rely on a devtools image. Devtools are moving away from mozilla central, so here we register a new image dedicated for this test. MozReview-Commit-ID: Log4J0eLudV --HG-- extra : rebase_source : 63890e9b4bbcf4de46190d42808ed92430f3c072
This commit is contained in:
parent
1b936ebd82
commit
3466153b93
@ -6,6 +6,7 @@ support-files =
|
|||||||
head.js
|
head.js
|
||||||
image.html
|
image.html
|
||||||
imageX2.html
|
imageX2.html
|
||||||
|
browser_docshell_type_editor/**
|
||||||
|
|
||||||
[browser_bug666317.js]
|
[browser_bug666317.js]
|
||||||
skip-if = true || e10s # Bug 1207012 - Permaorange from an uncaught exception that isn't actually turning the suite orange until it hits beta, Bug 948194 - Decoded Images seem to not be discarded on memory-pressure notification with e10s enabled
|
skip-if = true || e10s # Bug 1207012 - Permaorange from an uncaught exception that isn't actually turning the suite orange until it hits beta, Bug 948194 - Decoded Images seem to not be discarded on memory-pressure notification with e10s enabled
|
||||||
|
@ -4,14 +4,31 @@
|
|||||||
const Ci = Components.interfaces;
|
const Ci = Components.interfaces;
|
||||||
const SIMPLE_HTML = "data:text/html,<html><head></head><body></body></html>";
|
const SIMPLE_HTML = "data:text/html,<html><head></head><body></body></html>";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the directory where the chrome.manifest file for the test can be found.
|
||||||
|
*
|
||||||
|
* @return nsILocalFile of the manifest directory
|
||||||
|
*/
|
||||||
|
function getManifestDir() {
|
||||||
|
let path = getTestFilePath("browser_docshell_type_editor");
|
||||||
|
let file = Components.classes["@mozilla.org/file/local;1"]
|
||||||
|
.createInstance(Components.interfaces.nsILocalFile);
|
||||||
|
file.initWithPath(path);
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
// The following URI is *not* accessible to content, hence loading that URI
|
// The following URI is *not* accessible to content, hence loading that URI
|
||||||
// from an unprivileged site should be blocked. If docshell is of appType
|
// from an unprivileged site should be blocked. If docshell is of appType
|
||||||
// APP_TYPE_EDITOR however the load should be allowed.
|
// APP_TYPE_EDITOR however the load should be allowed.
|
||||||
// >> chrome://devtools/content/framework/dev-edition-promo/dev-edition-logo.png
|
// >> chrome://test1/skin/privileged.png
|
||||||
|
|
||||||
add_task(function* () {
|
add_task(function* () {
|
||||||
info("docshell of appType APP_TYPE_EDITOR can access privileged images.");
|
info("docshell of appType APP_TYPE_EDITOR can access privileged images.");
|
||||||
|
|
||||||
|
// Load a temporary manifest adding a route to a privileged image
|
||||||
|
let manifestDir = getManifestDir();
|
||||||
|
Components.manager.addBootstrappedManifestLocation(manifestDir);
|
||||||
|
|
||||||
yield BrowserTestUtils.withNewTab({
|
yield BrowserTestUtils.withNewTab({
|
||||||
gBrowser,
|
gBrowser,
|
||||||
url: SIMPLE_HTML
|
url: SIMPLE_HTML
|
||||||
@ -28,6 +45,7 @@ add_task(function* () {
|
|||||||
is(rootDocShell.appType, Ci.nsIDocShell.APP_TYPE_EDITOR,
|
is(rootDocShell.appType, Ci.nsIDocShell.APP_TYPE_EDITOR,
|
||||||
"sanity check: appType after update should be type editor");
|
"sanity check: appType after update should be type editor");
|
||||||
|
|
||||||
|
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
let doc = content.document;
|
let doc = content.document;
|
||||||
let image = doc.createElement("img");
|
let image = doc.createElement("img");
|
||||||
@ -44,15 +62,21 @@ add_task(function* () {
|
|||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
doc.body.appendChild(image);
|
doc.body.appendChild(image);
|
||||||
image.src = "chrome://devtools/content/framework/dev-edition-promo/dev-edition-logo.png";
|
image.src = "chrome://test1/skin/privileged.png";
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Components.manager.removeBootstrappedManifestLocation(manifestDir);
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(function* () {
|
add_task(function* () {
|
||||||
info("docshell of appType APP_TYPE_UNKNOWN can *not* access privileged images.");
|
info("docshell of appType APP_TYPE_UNKNOWN can *not* access privileged images.");
|
||||||
|
|
||||||
|
// Load a temporary manifest adding a route to a privileged image
|
||||||
|
let manifestDir = getManifestDir();
|
||||||
|
Components.manager.addBootstrappedManifestLocation(manifestDir);
|
||||||
|
|
||||||
yield BrowserTestUtils.withNewTab({
|
yield BrowserTestUtils.withNewTab({
|
||||||
gBrowser,
|
gBrowser,
|
||||||
url: SIMPLE_HTML
|
url: SIMPLE_HTML
|
||||||
@ -85,8 +109,10 @@ add_task(function* () {
|
|||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
doc.body.appendChild(image);
|
doc.body.appendChild(image);
|
||||||
image.src = "chrome://devtools/content/framework/dev-edition-promo/dev-edition-logo.png";
|
image.src = "chrome://test1/skin/privileged.png";
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Components.manager.removeBootstrappedManifestLocation(manifestDir);
|
||||||
});
|
});
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
skin test1 test img/
|
Binary file not shown.
After Width: | Height: | Size: 90 B |
Loading…
Reference in New Issue
Block a user