Observer/ContentPolicy bug

Posting here is no longer possible, please use the corresponding product forum.
Locked
chrisparker2000

Observer/ContentPolicy bug

Post by chrisparker2000 »

I'm looking at the source for 2.4, so this might be fixed in the trunk. I apologize if it is.

In contentPolicy.js, line 504-505

Code: Select all

if (this.previousRequest && subject.URI == this.previousRequest[0] &&
     subject instanceof Ci.nsIWritablePropertyBag)
The subject.URI is, I believe, an XPCOM wrapped URI. This is compared to this.previousRequest[0], which is set in line 457

Code: Select all

this.previousRequest = [location, contentType];
And location is set on line 443

Code: Select all

let location = Utils.unwrapURL(contentLocation);
contentLocation is from a parameter of shouldLoad of nsIContentPolicy, which is a nsIURI

So it appears to me that you are unwrapping one URL (contentLocation), but not unwrapping the other (subject.URI). I believe this makes it a certainty that these two are never equal, which would make the subsequent code, never execute.

Again, I may be wrong in this, and if I am I apologize for wasting your time.

I for one welcome our new weak-referenced overlords!
User avatar
greiner
ABP Developer
Posts: 899
Joined: Mon Sep 03, 2012 5:29 pm
Location: Cologne, Germany

Re: Observer/ContentPolicy bug

Post by greiner »

Both are of type nsIURI because Utils.unwrapURL makes sure to always treat the passed URL as a nsIURI by having this check at the beginning of the function:

Code: Select all

if (!(url instanceof Ci.nsIURI))
  url = Utils.makeURI(url);
Locked