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

Delta Between Two Patch Sets: lib/contentPolicy.js

Issue 29329396: Issue 3208 - Improve the approach used to detect pop-up URL (Closed)
Left Patch Set: Created Oct. 26, 2015, 8:11 p.m.
Right Patch Set: Fixed unbound this Created Oct. 29, 2015, 6:13 p.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-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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // be used in earlier releases. 391 // be used in earlier releases.
392 let httpTopic = "http-on-opening-request"; 392 let httpTopic = "http-on-opening-request";
393 if (Services.vc.compare(Utils.platformVersion, "18.0") < 0) 393 if (Services.vc.compare(Utils.platformVersion, "18.0") < 0)
394 httpTopic = "http-on-modify-request"; 394 httpTopic = "http-on-modify-request";
395 395
396 Services.obs.addObserver(this, httpTopic, true); 396 Services.obs.addObserver(this, httpTopic, true);
397 Services.obs.addObserver(this, "content-document-global-created", true); 397 Services.obs.addObserver(this, "content-document-global-created", true);
398 398
399 onShutdown.add(function() 399 onShutdown.add(function()
400 { 400 {
401 // Our category observers should be removed before changing category
402 // memberships, just in case.
403 Services.obs.removeObserver(this, httpTopic); 401 Services.obs.removeObserver(this, httpTopic);
404 Services.obs.removeObserver(this, "content-document-global-created"); 402 Services.obs.removeObserver(this, "content-document-global-created");
405 403
406 for (let category of this.xpcom_categories) 404 for (let category of this.xpcom_categories)
407 catMan.deleteCategoryEntry(category, this.contractID, false); 405 catMan.deleteCategoryEntry(category, this.contractID, false);
408 406
409 registrar.unregisterFactory(this.classID, this); 407 registrar.unregisterFactory(this.classID, this);
410 408
411 this.previousRequest = null; 409 this.previousRequest = null;
412 }.bind(this)); 410 }.bind(this));
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 let uri = additional || Utils.makeURI(subject.location.href); 475 let uri = additional || Utils.makeURI(subject.location.href);
478 if (!Policy.processNode(subject.opener, subject.opener.document, Policy. type.POPUP, uri, false)) 476 if (!Policy.processNode(subject.opener, subject.opener.document, Policy. type.POPUP, uri, false))
479 { 477 {
480 subject.stop(); 478 subject.stop();
481 Utils.runAsync(() => subject.close()); 479 Utils.runAsync(() => subject.close());
482 } 480 }
483 else if (uri.spec == "about:blank") 481 else if (uri.spec == "about:blank")
484 { 482 {
485 // An about:blank pop-up most likely means that a load will be 483 // An about:blank pop-up most likely means that a load will be
486 // initiated asynchronously. Wait for that. 484 // initiated asynchronously. Wait for that.
487 Utils.runAsync(function() 485 Utils.runAsync(() =>
488 { 486 {
489 let channel = subject.QueryInterface(Ci.nsIInterfaceRequestor) 487 let channel = subject.QueryInterface(Ci.nsIInterfaceRequestor)
490 .getInterface(Ci.nsIDocShell) 488 .getInterface(Ci.nsIDocShell)
491 .QueryInterface(Ci.nsIDocumentLoader) 489 .QueryInterface(Ci.nsIDocumentLoader)
492 .documentChannel; 490 .documentChannel;
493 if (channel) 491 if (channel)
494 this.observe(subject, topic, data, channel.URI.spec); 492 this.observe(subject, topic, data, channel.URI);
495 }); 493 });
496 } 494 }
497 break; 495 break;
498 } 496 }
499 case "http-on-opening-request": 497 case "http-on-opening-request":
500 case "http-on-modify-request": 498 case "http-on-modify-request":
501 { 499 {
502 if (!(subject instanceof Ci.nsIHttpChannel)) 500 if (!(subject instanceof Ci.nsIHttpChannel))
503 return; 501 return;
504 502
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 if (!wnd || wnd.closed) 774 if (!wnd || wnd.closed)
777 return; 775 return;
778 776
779 if (entry.type == Policy.type.OBJECT) 777 if (entry.type == Policy.type.OBJECT)
780 { 778 {
781 node.removeEventListener("mouseover", objectMouseEventHander, true); 779 node.removeEventListener("mouseover", objectMouseEventHander, true);
782 node.removeEventListener("mouseout", objectMouseEventHander, true); 780 node.removeEventListener("mouseout", objectMouseEventHander, true);
783 } 781 }
784 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ; 782 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ;
785 } 783 }
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