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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 // We just handled a content policy call for this request - associate | 507 // We just handled a content policy call for this request - associate |
508 // the data with the channel so that we can find it in case of a redir
ect. | 508 // the data with the channel so that we can find it in case of a redir
ect. |
509 subject.setProperty("abpRequestType", this.previousRequest[1]); | 509 subject.setProperty("abpRequestType", this.previousRequest[1]); |
510 this.previousRequest = null; | 510 this.previousRequest = null; |
511 } | 511 } |
512 | 512 |
513 if (this.expectingPopupLoad) | 513 if (this.expectingPopupLoad) |
514 { | 514 { |
515 let wnd = Utils.getRequestWindow(subject); | 515 let wnd = Utils.getRequestWindow(subject); |
516 if (wnd && wnd.opener && wnd.location.href == "about:blank") | 516 if (wnd && wnd.opener && wnd.location.href == "about:blank") |
| 517 { |
517 this.observe(wnd, "content-document-global-created", null, subject.U
RI); | 518 this.observe(wnd, "content-document-global-created", null, subject.U
RI); |
| 519 if (subject instanceof Ci.nsIWritablePropertyBag) |
| 520 subject.setProperty("abpRequestType", Policy.type.POPUP); |
| 521 } |
518 } | 522 } |
519 | 523 |
520 break; | 524 break; |
521 } | 525 } |
522 case "xpcom-category-entry-removed": | 526 case "xpcom-category-entry-removed": |
523 case "xpcom-category-cleared": | 527 case "xpcom-category-cleared": |
524 { | 528 { |
525 let category = data; | 529 let category = data; |
526 if (this.xpcom_categories.indexOf(category) < 0) | 530 if (this.xpcom_categories.indexOf(category) < 0) |
527 return; | 531 return; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 if (!wnd) | 581 if (!wnd) |
578 return; | 582 return; |
579 | 583 |
580 if (contentType == Policy.type.SUBDOCUMENT && wnd.parent == wnd.top && wnd
.opener) | 584 if (contentType == Policy.type.SUBDOCUMENT && wnd.parent == wnd.top && wnd
.opener) |
581 { | 585 { |
582 // This is a window opened in a new tab miscategorized as frame load, | 586 // This is a window opened in a new tab miscategorized as frame load, |
583 // see bug 467514. Get the frame as context to be at least consistent. | 587 // see bug 467514. Get the frame as context to be at least consistent. |
584 wnd = wnd.opener; | 588 wnd = wnd.opener; |
585 } | 589 } |
586 | 590 |
| 591 if (contentType == Policy.type.POPUP && wnd.opener) |
| 592 { |
| 593 // Popups are initiated by their opener, not their own window. |
| 594 wnd = wnd.opener; |
| 595 } |
| 596 |
587 if (!Policy.processNode(wnd, wnd.document, contentType, newLocation, false
)) | 597 if (!Policy.processNode(wnd, wnd.document, contentType, newLocation, false
)) |
588 result = Cr.NS_BINDING_ABORTED; | 598 result = Cr.NS_BINDING_ABORTED; |
589 } | 599 } |
590 catch (e) | 600 catch (e) |
591 { | 601 { |
592 // We shouldn't throw exceptions here - this will prevent the redirect. | 602 // We shouldn't throw exceptions here - this will prevent the redirect. |
593 Cu.reportError(e); | 603 Cu.reportError(e); |
594 } | 604 } |
595 finally | 605 finally |
596 { | 606 { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 if (!wnd || wnd.closed) | 765 if (!wnd || wnd.closed) |
756 return; | 766 return; |
757 | 767 |
758 if (entry.type == Policy.type.OBJECT) | 768 if (entry.type == Policy.type.OBJECT) |
759 { | 769 { |
760 node.removeEventListener("mouseover", objectMouseEventHander, true); | 770 node.removeEventListener("mouseover", objectMouseEventHander, true); |
761 node.removeEventListener("mouseout", objectMouseEventHander, true); | 771 node.removeEventListener("mouseout", objectMouseEventHander, true); |
762 } | 772 } |
763 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true)
; | 773 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true)
; |
764 } | 774 } |
OLD | NEW |