Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/contentPolicy.js

Issue 29329568: Issue 3208 - Moved checks related to context elements from Policy.shouldProcess() to PolicyImplemen… (Closed)
Patch Set: Created Oct. 30, 2015, 11:40 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/contentPolicy.js
===================================================================
--- a/lib/contentPolicy.js
+++ b/lib/contentPolicy.js
@@ -189,24 +189,16 @@ var Policy = exports.Policy =
break;
if (testWnd == testSitekeyWnd)
[testSitekey, testSitekeyWnd] = getSitekey(testWnd.parent);
testWnd = testWnd.parent;
}
}
- // Data loaded by plugins should be attached to the document
- if (contentType == "OBJECT_SUBREQUEST" && node instanceof Ci.nsIDOMElement)
- node = node.ownerDocument;
-
- // Fix type for objects misrepresented as frames or images
- if (contentType != "OBJECT" && (node instanceof Ci.nsIDOMHTMLObjectElement || node instanceof Ci.nsIDOMHTMLEmbedElement))
- contentType = "OBJECT";
-
if (!match && contentType == "ELEMHIDE")
{
match = location;
location = match.text.replace(/^.*?#/, '#');
if (!match.isActiveOnDomain(docDomain))
return true;
@@ -386,16 +378,24 @@ var PolicyImplementation =
// 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 = Policy.processNode(wnd, node, types.get(contentType), location.spec, false);
return (result ? Ci.nsIContentPolicy.ACCEPT : Ci.nsIContentPolicy.REJECT_REQUEST);
},
shouldProcess: function(contentType, contentLocation, requestOrigin, insecNode, mimeType, extra)
{
return Ci.nsIContentPolicy.ACCEPT;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld