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

Delta Between Two Patch Sets: lib/child/contentPolicy.js

Issue 29349811: Issue 4335 - Adblock Plus should forget pop-ups after the initial load (Closed)
Left Patch Set: Created Aug. 15, 2016, 6:28 p.m.
Right Patch Set: Use Symbol for dummy value Created Aug. 16, 2016, 10:35 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 shouldProcess: function(contentType, contentLocation, requestOrigin, insecNode , mimeType, extra) 306 shouldProcess: function(contentType, contentLocation, requestOrigin, insecNode , mimeType, extra)
307 { 307 {
308 return Ci.nsIContentPolicy.ACCEPT; 308 return Ci.nsIContentPolicy.ACCEPT;
309 }, 309 },
310 310
311 // 311 //
312 // nsIObserver interface implementation 312 // nsIObserver interface implementation
313 // 313 //
314 _openers: new WeakMap(), 314 _openers: new WeakMap(),
315 _alreadyLoaded: {}, 315 _alreadyLoaded: Symbol(),
316 316
317 observe: function(subject, topic, data, uri) 317 observe: function(subject, topic, data, uri)
318 { 318 {
319 switch (topic) 319 switch (topic)
320 { 320 {
321 case "document-element-inserted": 321 case "document-element-inserted":
322 { 322 {
323 let window = subject.defaultView; 323 let window = subject.defaultView;
324 if (!window) 324 if (!window)
325 return; 325 return;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 return; 411 return;
412 412
413 if (contentType == Ci.nsIContentPolicy.TYPE_DOCUMENT) 413 if (contentType == Ci.nsIContentPolicy.TYPE_DOCUMENT)
414 { 414 {
415 if (wnd.history.length <= 1 && wnd.opener) 415 if (wnd.history.length <= 1 && wnd.opener)
416 { 416 {
417 // Special treatment for pop-up windows - this will close the window 417 // Special treatment for pop-up windows - this will close the window
418 // rather than preventing the redirect. Note that we might not have 418 // rather than preventing the redirect. Note that we might not have
419 // seen the original channel yet because the redirect happened before 419 // seen the original channel yet because the redirect happened before
420 // the async code in observe() had a chance to run. 420 // the async code in observe() had a chance to run.
421 this.observe(wnd, "document-element-inserted", null, oldChannel.URI.sp ec); 421 this.observe(wnd.document, "document-element-inserted", null, oldChann el.URI.spec);
422 this.observe(wnd, "document-element-inserted", null, newChannel.URI.sp ec); 422 this.observe(wnd.document, "document-element-inserted", null, newChann el.URI.spec);
423 } 423 }
424 return; 424 return;
425 } 425 }
426 426
427 shouldAllowAsync(wnd, wnd.document, types.get(contentType), newChannel.URI .spec, function(allow) 427 shouldAllowAsync(wnd, wnd.document, types.get(contentType), newChannel.URI .spec, function(allow)
428 { 428 {
429 callback.onRedirectVerifyCallback(allow ? Cr.NS_OK : Cr.NS_BINDING_ABORT ED); 429 callback.onRedirectVerifyCallback(allow ? Cr.NS_OK : Cr.NS_BINDING_ABORT ED);
430 }); 430 });
431 async = true; 431 async = true;
432 } 432 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 let weights = parentNode[property].split(","); 509 let weights = parentNode[property].split(",");
510 weights[index] = "0"; 510 weights[index] = "0";
511 parentNode[property] = weights.join(","); 511 parentNode[property] = weights.join(",");
512 } 512 }
513 } 513 }
514 else 514 else
515 node.classList.add(cls); 515 node.classList.add(cls);
516 } 516 }
517 }); 517 });
518 } 518 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld