| Index: lib/child/contentPolicy.js |
| =================================================================== |
| --- a/lib/child/contentPolicy.js |
| +++ b/lib/child/contentPolicy.js |
| @@ -274,33 +274,38 @@ var PolicyImplementation = |
| // |
| shouldLoad: function(contentType, contentLocation, requestOrigin, node, mimeTypeGuess, extra) |
| { |
| // Ignore requests without context and top-level documents |
| if (!node || contentType == Ci.nsIContentPolicy.TYPE_DOCUMENT) |
| return Ci.nsIContentPolicy.ACCEPT; |
| + // Bail out early for chrome: an resource: URLs, this is a work-around for |
| + // https://bugzil.la/1127744 and https://bugzil.la/1247640 |
| + let location = Utils.unwrapURL(contentLocation); |
| + if (location.schemeIs("chrome") || location.schemeIs("resource")) |
| + return Ci.nsIContentPolicy.ACCEPT; |
| + |
| // Ignore standalone objects |
| if (contentType == Ci.nsIContentPolicy.TYPE_OBJECT && node.ownerDocument && !/^text\/|[+\/]xml$/.test(node.ownerDocument.contentType)) |
| return Ci.nsIContentPolicy.ACCEPT; |
| let wnd = Utils.getWindow(node); |
| if (!wnd) |
| return Ci.nsIContentPolicy.ACCEPT; |
| // Data loaded by plugins should be associated with the document |
| if (contentType == Ci.nsIContentPolicy.TYPE_OBJECT_SUBREQUEST && node instanceof Ci.nsIDOMElement) |
| node = node.ownerDocument; |
| // Fix type for objects misrepresented as frames or images |
| if (contentType != Ci.nsIContentPolicy.TYPE_OBJECT && (node instanceof Ci.nsIDOMHTMLObjectElement || node instanceof Ci.nsIDOMHTMLEmbedElement)) |
| contentType = Ci.nsIContentPolicy.TYPE_OBJECT; |
| - let location = Utils.unwrapURL(contentLocation); |
| let result = shouldAllow(wnd, node, types.get(contentType), location.spec); |
| return (result ? Ci.nsIContentPolicy.ACCEPT : Ci.nsIContentPolicy.REJECT_REQUEST); |
| }, |
| shouldProcess: function(contentType, contentLocation, requestOrigin, insecNode, mimeType, extra) |
| { |
| return Ci.nsIContentPolicy.ACCEPT; |
| }, |