OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 listener.onDataAvailable(this, context, stream, 0, stream.available()); | 117 listener.onDataAvailable(this, context, stream, 0, stream.available()); |
118 } catch(e) {} | 118 } catch(e) {} |
119 try { | 119 try { |
120 listener.onStopRequest(this, context, Cr.NS_OK); | 120 listener.onStopRequest(this, context, Cr.NS_OK); |
121 } catch(e) {} | 121 } catch(e) {} |
122 }, this); | 122 }, this); |
123 }, | 123 }, |
124 | 124 |
125 open: function() | 125 open: function() |
126 { | 126 { |
127 let {Policy} = require("contentPolicy"); | |
128 let {ElemHide} = require("elemHide"); | 127 let {ElemHide} = require("elemHide"); |
129 let data = "<bindings xmlns='http://www.mozilla.org/xbl'><binding id='dummy'
/></bindings>"; | 128 let data = "<bindings xmlns='http://www.mozilla.org/xbl'><binding id='dummy'
/></bindings>"; |
130 let filter = ElemHide.getFilterByKey(this.key); | 129 let filter = ElemHide.getFilterByKey(this.key); |
131 if (filter) | 130 if (filter) |
132 { | 131 { |
133 let wnd = Utils.getRequestWindow(this); | 132 let wnd = Utils.getRequestWindow(this); |
134 if (wnd && wnd.document && !Policy.processNode(wnd, wnd.document, Policy.t
ype.ELEMHIDE, filter)) | 133 if (wnd && wnd.document && !ElemHide.shouldAllowLoad(wnd, filter)) |
135 data = "<bindings xmlns='http://www.mozilla.org/xbl'/>"; | 134 data = "<bindings xmlns='http://www.mozilla.org/xbl'/>"; |
136 } | 135 } |
137 | 136 |
138 let stream = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(Ci.n
sIStringInputStream); | 137 let stream = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(Ci.n
sIStringInputStream); |
139 stream.setData(data, data.length); | 138 stream.setData(data, data.length); |
140 return stream; | 139 return stream; |
141 }, | 140 }, |
142 isPending: function() | 141 isPending: function() |
143 { | 142 { |
144 return false; | 143 return false; |
145 }, | 144 }, |
146 cancel: function() | 145 cancel: function() |
147 { | 146 { |
148 throw Cr.NS_ERROR_NOT_IMPLEMENTED; | 147 throw Cr.NS_ERROR_NOT_IMPLEMENTED; |
149 }, | 148 }, |
150 suspend: function() | 149 suspend: function() |
151 { | 150 { |
152 throw Cr.NS_ERROR_NOT_IMPLEMENTED; | 151 throw Cr.NS_ERROR_NOT_IMPLEMENTED; |
153 }, | 152 }, |
154 resume: function() | 153 resume: function() |
155 { | 154 { |
156 throw Cr.NS_ERROR_NOT_IMPLEMENTED; | 155 throw Cr.NS_ERROR_NOT_IMPLEMENTED; |
157 }, | 156 }, |
158 | 157 |
159 QueryInterface: XPCOMUtils.generateQI([Ci.nsIChannel, Ci.nsIRequest]) | 158 QueryInterface: XPCOMUtils.generateQI([Ci.nsIChannel, Ci.nsIRequest]) |
160 }; | 159 }; |
OLD | NEW |