Bug 1279285 - Set the SANDBOXED_AUXILARY_NAVIGATION flag when rendering thumbnails in the background, r=bz

MozReview-Commit-ID: 4grdy6evhrb
This commit is contained in:
Michael Layzell 2016-08-30 10:18:07 -04:00
parent fe73634c76
commit 29df86a9be

View File

@ -14,6 +14,14 @@ const STATE_LOADING = 1;
const STATE_CAPTURING = 2;
const STATE_CANCELED = 3;
// NOTE: Copied from nsSandboxFlags.h
/**
* This flag prevents content from creating new auxiliary browsing contexts,
* e.g. using the target attribute, the window.open() method, or the
* showModalDialog() method.
*/
const SANDBOXED_AUXILIARY_NAVIGATION = 0x2;
const backgroundPageThumbsContent = {
init: function () {
@ -33,6 +41,7 @@ const backgroundPageThumbsContent = {
Ci.nsIRequest.INHIBIT_CACHING |
Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY;
docShell.defaultLoadFlags = defaultFlags;
docShell.sandboxFlags |= SANDBOXED_AUXILIARY_NAVIGATION;
addMessageListener("BackgroundPageThumbs:capture",
this._onCapture.bind(this));