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

Side by Side Diff: lib/contentPolicy.js

Issue 29329450: Issue 3208 - Don`t use numerical content types outside nsIContentPolicy.shouldLoad (Closed)
Patch Set: Removed unrelated change Created Nov. 4, 2015, 9:27 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/content/ui/composer.js ('k') | lib/elemHide.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 16 matching lines...) Expand all
27 let {Utils} = require("utils"); 27 let {Utils} = require("utils");
28 let {Prefs} = require("prefs"); 28 let {Prefs} = require("prefs");
29 let {FilterStorage} = require("filterStorage"); 29 let {FilterStorage} = require("filterStorage");
30 let {BlockingFilter, WhitelistFilter, RegExpFilter} = require("filterClasses"); 30 let {BlockingFilter, WhitelistFilter, RegExpFilter} = require("filterClasses");
31 let {defaultMatcher} = require("matcher"); 31 let {defaultMatcher} = require("matcher");
32 let {objectMouseEventHander} = require("objectTabs"); 32 let {objectMouseEventHander} = require("objectTabs");
33 let {RequestNotifier} = require("requestNotifier"); 33 let {RequestNotifier} = require("requestNotifier");
34 let {ElemHide} = require("elemHide"); 34 let {ElemHide} = require("elemHide");
35 35
36 /** 36 /**
37 * List of explicitly supported content types 37 * Set of explicitly supported content types
38 * @type string[] 38 * @type Set
39 */ 39 */
40 let contentTypes = ["OTHER", "SCRIPT", "IMAGE", "STYLESHEET", "OBJECT", "SUBDOCU MENT", "DOCUMENT", "XMLHTTPREQUEST", "OBJECT_SUBREQUEST", "FONT", "MEDIA"]; 40 let contentTypes = new Set([
41 "OTHER", "SCRIPT", "IMAGE", "STYLESHEET", "OBJECT", "SUBDOCUMENT", "DOCUMENT",
42 "XMLHTTPREQUEST", "OBJECT_SUBREQUEST", "FONT", "MEDIA", "ELEMHIDE", "POPUP",
43 "GENERICHIDE", "GENERICBLOCK"
44 ]);
41 45
42 /** 46 /**
43 * List of content types that aren't associated with a visual document area 47 * Set of content types that aren't associated with a visual document area
44 * @type string[] 48 * @type Set
45 */ 49 */
46 let nonVisualTypes = ["SCRIPT", "STYLESHEET", "XMLHTTPREQUEST", "OBJECT_SUBREQUE ST", "FONT"]; 50 let nonVisualTypes = new Set([
51 "SCRIPT", "STYLESHEET", "XMLHTTPREQUEST", "OBJECT_SUBREQUEST", "FONT",
52 "ELEMHIDE", "POPUP", "GENERICHIDE", "GENERICBLOCK"
53 ]);
47 54
48 /** 55 /**
49 * Randomly generated class name, to be applied to collapsed nodes. 56 * Randomly generated class name, to be applied to collapsed nodes.
50 */ 57 */
51 let collapsedClass = ""; 58 let collapsedClass = "";
52 59
53 /** 60 /**
61 * Maps numerical content type IDs to strings.
62 * @type Map
63 */
64 let types = new Map();
65
66 /**
54 * Public policy checking functions and auxiliary objects 67 * Public policy checking functions and auxiliary objects
55 * @class 68 * @class
56 */ 69 */
57 var Policy = exports.Policy = 70 var Policy = exports.Policy =
58 { 71 {
59 /** 72 /**
60 * Map of content type identifiers by their name. 73 * Map of localized content type names by their identifiers.
61 * @type Object 74 * @type Map
62 */ 75 */
63 type: {}, 76 localizedDescr: new Map(),
64
65 /**
66 * Map of content type names by their identifiers (reverse of type map).
67 * @type Object
68 */
69 typeDescr: {},
70
71 /**
72 * Map of numerical content types with their corresponding masks
73 * @type Object
74 */
75 typeMask: {},
76
77 /**
78 * Map of localized content type names by their identifiers.
79 * @type Object
80 */
81 localizedDescr: {},
82
83 /**
84 * Lists the non-visual content types.
85 * @type Object
86 */
87 nonVisual: {},
88 77
89 /** 78 /**
90 * Map containing all schemes that should be ignored by content policy. 79 * Map containing all schemes that should be ignored by content policy.
91 * @type Set 80 * @type Set
92 */ 81 */
93 whitelistSchemes: new Set(), 82 whitelistSchemes: new Set(),
94 83
95 /** 84 /**
96 * Called on module startup, initializes various exported properties. 85 * Called on module startup, initializes various exported properties.
97 */ 86 */
98 init: function() 87 init: function()
99 { 88 {
100 // type constant by type description and type description by type constant 89 // Populate types map
101 let iface = Ci.nsIContentPolicy; 90 let iface = Ci.nsIContentPolicy;
91 for (let name in iface)
92 if (name.indexOf("TYPE_") == 0 && name != "TYPE_DATAREQUEST")
93 types.set(iface[name], name.substr(5));
94
95 // Populate localized type names
102 for (let typeName of contentTypes) 96 for (let typeName of contentTypes)
103 { 97 this.localizedDescr.set(typeName, Utils.getString("type_label_" + typeName .toLowerCase()));
104 if ("TYPE_" + typeName in iface)
105 {
106 let id = iface["TYPE_" + typeName];
107 this.type[typeName] = id;
108 this.typeDescr[id] = typeName;
109 this.localizedDescr[id] = Utils.getString("type_label_" + typeName.toLow erCase());
110 this.typeMask[id] = RegExpFilter.typeMap[typeName];
111 }
112 }
113
114 this.type.GENERICBLOCK = 0xFFFB;
115 this.typeDescr[0xFFFB] = "GENERICBLOCK";
116 this.localizedDescr[0xFFFB] = Utils.getString("type_label_genericblock");
117 this.typeMask[0xFFFB] = RegExpFilter.typeMap.GENERICBLOCK;
118
119 this.type.GENERICHIDE = 0xFFFC;
120 this.typeDescr[0xFFFC] = "GENERICHIDE";
121 this.localizedDescr[0xFFFC] = Utils.getString("type_label_generichide");
122 this.typeMask[0xFFFC] = RegExpFilter.typeMap.GENERICHIDE;
123
124 this.type.ELEMHIDE = 0xFFFD;
125 this.typeDescr[0xFFFD] = "ELEMHIDE";
126 this.localizedDescr[0xFFFD] = Utils.getString("type_label_elemhide");
127 this.typeMask[0xFFFD] = RegExpFilter.typeMap.ELEMHIDE;
128
129 this.type.POPUP = 0xFFFE;
130 this.typeDescr[0xFFFE] = "POPUP";
131 this.localizedDescr[0xFFFE] = Utils.getString("type_label_popup");
132 this.typeMask[0xFFFE] = RegExpFilter.typeMap.POPUP;
133
134 for (let type of nonVisualTypes)
135 this.nonVisual[this.type[type]] = true;
136 98
137 // whitelisted URL schemes 99 // whitelisted URL schemes
138 for (let scheme of Prefs.whitelistschemes.toLowerCase().split(" ")) 100 for (let scheme of Prefs.whitelistschemes.toLowerCase().split(" "))
139 this.whitelistSchemes.add(scheme); 101 this.whitelistSchemes.add(scheme);
140 102
141 // Generate class identifier used to collapse node and register correspondin g 103 // Generate class identifier used to collapse node and register correspondin g
142 // stylesheet. 104 // stylesheet.
143 let offset = "a".charCodeAt(0); 105 let offset = "a".charCodeAt(0);
144 for (let i = 0; i < 20; i++) 106 for (let i = 0; i < 20; i++)
145 collapsedClass += String.fromCharCode(offset + Math.random() * 26); 107 collapsedClass += String.fromCharCode(offset + Math.random() * 26);
(...skipping 16 matching lines...) Expand all
162 * @param location {nsIURI} 124 * @param location {nsIURI}
163 * @param collapse {Boolean} true to force hiding of the node 125 * @param collapse {Boolean} true to force hiding of the node
164 * @return {Boolean} false if the node should be blocked 126 * @return {Boolean} false if the node should be blocked
165 */ 127 */
166 processNode: function(wnd, node, contentType, location, collapse) 128 processNode: function(wnd, node, contentType, location, collapse)
167 { 129 {
168 let topWnd = wnd.top; 130 let topWnd = wnd.top;
169 if (!topWnd || !topWnd.location || !topWnd.location.href) 131 if (!topWnd || !topWnd.location || !topWnd.location.href)
170 return true; 132 return true;
171 133
134 // Interpret unknown types as "other"
135 if (!contentTypes.has(contentType))
136 contentType = "OTHER";
137
172 let originWindow = Utils.getOriginWindow(wnd); 138 let originWindow = Utils.getOriginWindow(wnd);
173 let wndLocation = originWindow.location.href; 139 let wndLocation = originWindow.location.href;
174 let docDomain = getHostname(wndLocation); 140 let docDomain = getHostname(wndLocation);
175 let match = null; 141 let match = null;
176 let [sitekey, sitekeyWnd] = getSitekey(wnd); 142 let [sitekey, sitekeyWnd] = getSitekey(wnd);
177 let nogeneric = false; 143 let nogeneric = false;
178 144
179 function cleanWindowLocation(wnd) 145 function cleanWindowLocation(wnd)
180 { 146 {
181 let url = getWindowLocation(wnd); 147 let url = getWindowLocation(wnd);
(...skipping 10 matching lines...) Expand all
192 let testSitekey = sitekey; 158 let testSitekey = sitekey;
193 let testSitekeyWnd = sitekeyWnd; 159 let testSitekeyWnd = sitekeyWnd;
194 let parentWndLocation = cleanWindowLocation(testWnd); 160 let parentWndLocation = cleanWindowLocation(testWnd);
195 while (true) 161 while (true)
196 { 162 {
197 let testWndLocation = parentWndLocation; 163 let testWndLocation = parentWndLocation;
198 parentWndLocation = (testWnd == testWnd.parent ? testWndLocation : clean WindowLocation(testWnd.parent)); 164 parentWndLocation = (testWnd == testWnd.parent ? testWndLocation : clean WindowLocation(testWnd.parent));
199 let parentDocDomain = getHostname(parentWndLocation); 165 let parentDocDomain = getHostname(parentWndLocation);
200 166
201 let typeMap = RegExpFilter.typeMap.DOCUMENT; 167 let typeMap = RegExpFilter.typeMap.DOCUMENT;
202 if (contentType == Policy.type.ELEMHIDE) 168 if (contentType == "ELEMHIDE")
203 typeMap = typeMap | RegExpFilter.typeMap.ELEMHIDE; 169 typeMap = typeMap | RegExpFilter.typeMap.ELEMHIDE;
204 let whitelistMatch = defaultMatcher.matchesAny(testWndLocation, typeMap, parentDocDomain, false, sitekey); 170 let whitelistMatch = defaultMatcher.matchesAny(testWndLocation, typeMap, parentDocDomain, false, sitekey);
205 if (whitelistMatch instanceof WhitelistFilter) 171 if (whitelistMatch instanceof WhitelistFilter)
206 { 172 {
207 FilterStorage.increaseHitCount(whitelistMatch, wnd); 173 FilterStorage.increaseHitCount(whitelistMatch, wnd);
208 RequestNotifier.addNodeData(testWnd.document, topWnd, 174 RequestNotifier.addNodeData(testWnd.document, topWnd,
209 (whitelistMatch.contentType & RegExpFilter.typeMap.DOCUMENT) ? Polic y.type.DOCUMENT : Policy.type.ELEMHIDE, 175 (whitelistMatch.contentType & RegExpFilter.typeMap.DOCUMENT) ? "DOCU MENT" : "ELEMHIDE",
210 parentDocDomain, false, testWndLocation, whitelistMatch); 176 parentDocDomain, false, testWndLocation, whitelistMatch);
211 return true; 177 return true;
212 } 178 }
213 179
214 let genericType = (contentType == Policy.type.ELEMHIDE ? 180 let genericType = (contentType == "ELEMHIDE" ? "GENERICHIDE" : "GENERICB LOCK");
215 Policy.type.GENERICHIDE :
216 Policy.type.GENERICBLOCK);
217 let nogenericMatch = defaultMatcher.matchesAny(testWndLocation, 181 let nogenericMatch = defaultMatcher.matchesAny(testWndLocation,
218 Policy.typeMask[genericType], parentDocDomain, false, testSitekey); 182 RegExpFilter.typeMap[genericType], parentDocDomain, false, testSitek ey);
219 if (nogenericMatch instanceof WhitelistFilter) 183 if (nogenericMatch instanceof WhitelistFilter)
220 { 184 {
221 nogeneric = true; 185 nogeneric = true;
222 186
223 FilterStorage.increaseHitCount(nogenericMatch, wnd); 187 FilterStorage.increaseHitCount(nogenericMatch, wnd);
224 RequestNotifier.addNodeData(testWnd.document, topWnd, genericType, 188 RequestNotifier.addNodeData(testWnd.document, topWnd, genericType,
225 parentDocDomain, false, testWndLocation, 189 parentDocDomain, false, testWndLocation,
226 nogenericMatch); 190 nogenericMatch);
227 } 191 }
228 192
229 if (testWnd.parent == testWnd) 193 if (testWnd.parent == testWnd)
230 break; 194 break;
231 195
232 if (testWnd == testSitekeyWnd) 196 if (testWnd == testSitekeyWnd)
233 [testSitekey, testSitekeyWnd] = getSitekey(testWnd.parent); 197 [testSitekey, testSitekeyWnd] = getSitekey(testWnd.parent);
234 testWnd = testWnd.parent; 198 testWnd = testWnd.parent;
235 } 199 }
236 } 200 }
237 201
238 // Data loaded by plugins should be attached to the document 202 // Data loaded by plugins should be attached to the document
239 if (contentType == Policy.type.OBJECT_SUBREQUEST && node instanceof Ci.nsIDO MElement) 203 if (contentType == "OBJECT_SUBREQUEST" && node instanceof Ci.nsIDOMElement)
240 node = node.ownerDocument; 204 node = node.ownerDocument;
241 205
242 // Fix type for objects misrepresented as frames or images 206 // Fix type for objects misrepresented as frames or images
243 if (contentType != Policy.type.OBJECT && (node instanceof Ci.nsIDOMHTMLObjec tElement || node instanceof Ci.nsIDOMHTMLEmbedElement)) 207 if (contentType != "OBJECT" && (node instanceof Ci.nsIDOMHTMLObjectElement | | node instanceof Ci.nsIDOMHTMLEmbedElement))
244 contentType = Policy.type.OBJECT; 208 contentType = "OBJECT";
245 209
246 let locationText = location.spec; 210 let locationText = location.spec;
247 if (!match && contentType == Policy.type.ELEMHIDE) 211 if (!match && contentType == "ELEMHIDE")
248 { 212 {
249 match = location; 213 match = location;
250 locationText = match.text.replace(/^.*?#/, '#'); 214 locationText = match.text.replace(/^.*?#/, '#');
251 location = locationText; 215 location = locationText;
252 216
253 if (!match.isActiveOnDomain(docDomain)) 217 if (!match.isActiveOnDomain(docDomain))
254 return true; 218 return true;
255 219
256 let exception = ElemHide.getException(match, docDomain); 220 let exception = ElemHide.getException(match, docDomain);
257 if (exception) 221 if (exception)
258 { 222 {
259 FilterStorage.increaseHitCount(exception, wnd); 223 FilterStorage.increaseHitCount(exception, wnd);
260 RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, false, locationText, exception); 224 RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, false, locationText, exception);
261 return true; 225 return true;
262 } 226 }
263 227
264 if (nogeneric && match.isGeneric()) 228 if (nogeneric && match.isGeneric())
265 return true; 229 return true;
266 } 230 }
267 231
268 let thirdParty = (contentType == Policy.type.ELEMHIDE ? false : isThirdParty (location, docDomain)); 232 let thirdParty = (contentType == "ELEMHIDE" ? false : isThirdParty(location, docDomain));
269 233
270 if (!match && Prefs.enabled && contentType in Policy.typeMask) 234 if (!match && Prefs.enabled && RegExpFilter.typeMap.hasOwnProperty(contentTy pe))
271 { 235 {
272 match = defaultMatcher.matchesAny(locationText, Policy.typeMask[contentTyp e], 236 match = defaultMatcher.matchesAny(locationText, RegExpFilter.typeMap[conte ntType],
273 docDomain, thirdParty, sitekey, nogeneri c); 237 docDomain, thirdParty, sitekey, nogeneri c);
274 if (match instanceof BlockingFilter && node.ownerDocument && !(contentType in Policy.nonVisual)) 238 if (match instanceof BlockingFilter && node.ownerDocument && !nonVisualTyp es.has(contentType))
275 { 239 {
276 let prefCollapse = (match.collapse != null ? match.collapse : !Prefs.fas tcollapse); 240 let prefCollapse = (match.collapse != null ? match.collapse : !Prefs.fas tcollapse);
277 if (collapse || prefCollapse) 241 if (collapse || prefCollapse)
278 schedulePostProcess(node); 242 schedulePostProcess(node);
279 } 243 }
280 244
281 // Track mouse events for objects 245 // Track mouse events for objects
282 if (!match && contentType == Policy.type.OBJECT && node.nodeType == Ci.nsI DOMNode.ELEMENT_NODE) 246 if (!match && contentType == "OBJECT" && node.nodeType == Ci.nsIDOMNode.EL EMENT_NODE)
283 { 247 {
284 node.addEventListener("mouseover", objectMouseEventHander, true); 248 node.addEventListener("mouseover", objectMouseEventHander, true);
285 node.addEventListener("mouseout", objectMouseEventHander, true); 249 node.addEventListener("mouseout", objectMouseEventHander, true);
286 } 250 }
287 } 251 }
288 252
289 // Store node data 253 // Store node data
290 RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, thirdParty , locationText, match); 254 RequestNotifier.addNodeData(node, topWnd, contentType, docDomain, thirdParty , locationText, match);
291 if (match) 255 if (match)
292 FilterStorage.increaseHitCount(match, wnd); 256 FilterStorage.increaseHitCount(match, wnd);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPolicy, Ci.nsIObserver, 367 QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPolicy, Ci.nsIObserver,
404 Ci.nsIChannelEventSink, Ci.nsIFactory, Ci.nsISupportsWeakReference]), 368 Ci.nsIChannelEventSink, Ci.nsIFactory, Ci.nsISupportsWeakReference]),
405 369
406 // 370 //
407 // nsIContentPolicy interface implementation 371 // nsIContentPolicy interface implementation
408 // 372 //
409 373
410 shouldLoad: function(contentType, contentLocation, requestOrigin, node, mimeTy peGuess, extra) 374 shouldLoad: function(contentType, contentLocation, requestOrigin, node, mimeTy peGuess, extra)
411 { 375 {
412 // Ignore requests without context and top-level documents 376 // Ignore requests without context and top-level documents
413 if (!node || contentType == Policy.type.DOCUMENT) 377 if (!node || contentType == Ci.nsIContentPolicy.TYPE_DOCUMENT)
414 return Ci.nsIContentPolicy.ACCEPT; 378 return Ci.nsIContentPolicy.ACCEPT;
415 379
416 // Ignore standalone objects 380 // Ignore standalone objects
417 if (contentType == Policy.type.OBJECT && node.ownerDocument && !/^text\/|[+\ /]xml$/.test(node.ownerDocument.contentType)) 381 if (contentType == Ci.nsIContentPolicy.TYPE_OBJECT && node.ownerDocument && !/^text\/|[+\/]xml$/.test(node.ownerDocument.contentType))
418 return Ci.nsIContentPolicy.ACCEPT; 382 return Ci.nsIContentPolicy.ACCEPT;
419 383
420 let wnd = Utils.getWindow(node); 384 let wnd = Utils.getWindow(node);
421 if (!wnd) 385 if (!wnd)
422 return Ci.nsIContentPolicy.ACCEPT; 386 return Ci.nsIContentPolicy.ACCEPT;
423 387
424 // Ignore whitelisted schemes 388 // Ignore whitelisted schemes
425 let location = Utils.unwrapURL(contentLocation); 389 let location = Utils.unwrapURL(contentLocation);
426 if (!Policy.isBlockableScheme(location)) 390 if (!Policy.isBlockableScheme(location))
427 return Ci.nsIContentPolicy.ACCEPT; 391 return Ci.nsIContentPolicy.ACCEPT;
428 392
429 // Interpret unknown types as "other" 393 let result = Policy.processNode(wnd, node, types.get(contentType), location, false);
430 if (!(contentType in Policy.typeDescr))
431 contentType = Policy.type.OTHER;
432
433 let result = Policy.processNode(wnd, node, contentType, location, false);
434 return (result ? Ci.nsIContentPolicy.ACCEPT : Ci.nsIContentPolicy.REJECT_REQ UEST); 394 return (result ? Ci.nsIContentPolicy.ACCEPT : Ci.nsIContentPolicy.REJECT_REQ UEST);
435 }, 395 },
436 396
437 shouldProcess: function(contentType, contentLocation, requestOrigin, insecNode , mimeType, extra) 397 shouldProcess: function(contentType, contentLocation, requestOrigin, insecNode , mimeType, extra)
438 { 398 {
439 return Ci.nsIContentPolicy.ACCEPT; 399 return Ci.nsIContentPolicy.ACCEPT;
440 }, 400 },
441 401
442 // 402 //
443 // nsIObserver interface implementation 403 // nsIObserver interface implementation
444 // 404 //
445 observe: function(subject, topic, data, additional) 405 observe: function(subject, topic, data, additional)
446 { 406 {
447 switch (topic) 407 switch (topic)
448 { 408 {
449 case "content-document-global-created": 409 case "content-document-global-created":
450 { 410 {
451 if (!(subject instanceof Ci.nsIDOMWindow) || !subject.opener) 411 if (!(subject instanceof Ci.nsIDOMWindow) || !subject.opener)
452 return; 412 return;
453 413
454 let uri = additional || Utils.makeURI(subject.location.href); 414 let uri = additional || Utils.makeURI(subject.location.href);
455 if (!Policy.processNode(subject.opener, subject.opener.document, Policy. type.POPUP, uri, false)) 415 if (!Policy.processNode(subject.opener, subject.opener.document, "POPUP" , uri, false))
456 { 416 {
457 subject.stop(); 417 subject.stop();
458 Utils.runAsync(() => subject.close()); 418 Utils.runAsync(() => subject.close());
459 } 419 }
460 else if (uri.spec == "about:blank") 420 else if (uri.spec == "about:blank")
461 { 421 {
462 // An about:blank pop-up most likely means that a load will be 422 // An about:blank pop-up most likely means that a load will be
463 // initiated asynchronously. Wait for that. 423 // initiated asynchronously. Wait for that.
464 Utils.runAsync(() => 424 Utils.runAsync(() =>
465 { 425 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 { 463 {
504 // Special treatment for pop-up windows. Note that we might not have 464 // Special treatment for pop-up windows. Note that we might not have
505 // seen the original channel yet because the redirect happened before 465 // seen the original channel yet because the redirect happened before
506 // the async code in observe() had a chance to run. 466 // the async code in observe() had a chance to run.
507 this.observe(wnd, "content-document-global-created", null, oldChannel. URI); 467 this.observe(wnd, "content-document-global-created", null, oldChannel. URI);
508 this.observe(wnd, "content-document-global-created", null, newChannel. URI); 468 this.observe(wnd, "content-document-global-created", null, newChannel. URI);
509 } 469 }
510 return; 470 return;
511 } 471 }
512 472
513 if (!Policy.processNode(wnd, wnd.document, contentType, newChannel.URI, fa lse)) 473 if (!Policy.processNode(wnd, wnd.document, types.get(contentType), newChan nel.URI, false))
514 result = Cr.NS_BINDING_ABORTED; 474 result = Cr.NS_BINDING_ABORTED;
515 } 475 }
516 catch (e) 476 catch (e)
517 { 477 {
518 // We shouldn't throw exceptions here - this will prevent the redirect. 478 // We shouldn't throw exceptions here - this will prevent the redirect.
519 Cu.reportError(e); 479 Cu.reportError(e);
520 } 480 }
521 finally 481 finally
522 { 482 {
523 callback.onRedirectVerifyCallback(result); 483 callback.onRedirectVerifyCallback(result);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 675
716 /** 676 /**
717 * Re-checks filters on an element. 677 * Re-checks filters on an element.
718 */ 678 */
719 function refilterNode(/**Node*/ node, /**RequestEntry*/ entry) 679 function refilterNode(/**Node*/ node, /**RequestEntry*/ entry)
720 { 680 {
721 let wnd = Utils.getWindow(node); 681 let wnd = Utils.getWindow(node);
722 if (!wnd || wnd.closed) 682 if (!wnd || wnd.closed)
723 return; 683 return;
724 684
725 if (entry.type == Policy.type.OBJECT) 685 if (entry.type == "OBJECT")
726 { 686 {
727 node.removeEventListener("mouseover", objectMouseEventHander, true); 687 node.removeEventListener("mouseover", objectMouseEventHander, true);
728 node.removeEventListener("mouseout", objectMouseEventHander, true); 688 node.removeEventListener("mouseout", objectMouseEventHander, true);
729 } 689 }
730 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ; 690 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ;
731 } 691 }
OLDNEW
« no previous file with comments | « chrome/content/ui/composer.js ('k') | lib/elemHide.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld