| Index: lib/child/elemHide.js | 
| =================================================================== | 
| --- a/lib/child/elemHide.js | 
| +++ b/lib/child/elemHide.js | 
| @@ -29,18 +29,18 @@ try | 
| } | 
| catch (e) | 
| { | 
| Cu.reportError(e); | 
| } | 
|  | 
| let {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {}); | 
|  | 
| +let {shouldAllow} = require("child/contentPolicy"); | 
| let {Utils} = require("utils"); | 
| -let {getFrames, isPrivate} = require("child/utils"); | 
|  | 
| // The allowXBL binding below won't have any effect on the element. For elements | 
| // that should be hidden however we don't return any binding at all, this makes | 
| // Gecko stop constructing the node - it cannot be shown. | 
| const allowXBL = "<bindings xmlns='http://www.mozilla.org/xbl'><binding id='dummy' bindToUntrustedContent='true'/></bindings>"; | 
| const hideXBL = "<bindings xmlns='http://www.mozilla.org/xbl'/>"; | 
|  | 
| /** | 
| @@ -124,39 +124,35 @@ HitRegistrationChannel.prototype = { | 
| notificationCallbacks: null, | 
| loadFlags: 0, | 
| loadGroup: null, | 
| name: null, | 
| status: Cr.NS_OK, | 
|  | 
| asyncOpen: function(listener, context) | 
| { | 
| -    let processResponse = (response) => | 
| +    let processResponse = (allow) => | 
| { | 
| -      let data = (response ? hideXBL : allowXBL); | 
| +      let data = (allow ? allowXBL : hideXBL); | 
| let stream = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(Ci.nsIStringInputStream); | 
| stream.setData(data, data.length); | 
|  | 
| try { | 
| listener.onStartRequest(this, context); | 
| } catch(e) {} | 
| try { | 
| listener.onDataAvailable(this, context, stream, 0, stream.available()); | 
| } catch(e) {} | 
| try { | 
| listener.onStopRequest(this, context, Cr.NS_OK); | 
| } catch(e) {} | 
| }; | 
|  | 
| let window = Utils.getRequestWindow(this); | 
| -    sendAsyncMessage("AdblockPlus:ElemHideHit", { | 
| -      key: this.key, | 
| -      frames: getFrames(window), | 
| -      isPrivate: isPrivate(window) | 
| -    }, processResponse); | 
| +    shouldAllow(window, window.document, "ELEMHIDE", this.key, processResponse); | 
| }, | 
|  | 
| asyncOpen2: function(listener) | 
| { | 
| if (!this.loadInfo.triggeringPrincipal.equals(Utils.systemPrincipal)) | 
| throw Cr.NS_ERROR_FAILURE; | 
| this.asyncOpen(listener, null); | 
| }, | 
|  |