| OLD | NEW |
| 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 { | 544 { |
| 545 newLocation = newChannel.URI; | 545 newLocation = newChannel.URI; |
| 546 } catch(e2) {} | 546 } catch(e2) {} |
| 547 if (!newLocation) | 547 if (!newLocation) |
| 548 return; | 548 return; |
| 549 | 549 |
| 550 let wnd = Utils.getRequestWindow(newChannel); | 550 let wnd = Utils.getRequestWindow(newChannel); |
| 551 if (!wnd) | 551 if (!wnd) |
| 552 return; | 552 return; |
| 553 | 553 |
| 554 if (contentType == Policy.type.POPUP && wnd.opener) | 554 if (contentType == Ci.nsIContentPolicy.TYPE_DOCUMENT) |
| 555 { | 555 { |
| 556 // Popups are initiated by their opener, not their own window. | 556 if (wnd.history.length <= 1 && wnd.opener) |
| 557 wnd = wnd.opener; | 557 { |
| 558 // Special treatment for pop-up windows |
| 559 this.observe(wnd, "content-document-global-created", null, newLocation
); |
| 560 } |
| 561 return; |
| 558 } | 562 } |
| 559 | 563 |
| 560 if (!Policy.processNode(wnd, wnd.document, contentType, newLocation, false
)) | 564 if (!Policy.processNode(wnd, wnd.document, contentType, newLocation, false
)) |
| 561 result = Cr.NS_BINDING_ABORTED; | 565 result = Cr.NS_BINDING_ABORTED; |
| 562 } | 566 } |
| 563 catch (e) | 567 catch (e) |
| 564 { | 568 { |
| 565 // We shouldn't throw exceptions here - this will prevent the redirect. | 569 // We shouldn't throw exceptions here - this will prevent the redirect. |
| 566 Cu.reportError(e); | 570 Cu.reportError(e); |
| 567 } | 571 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 if (!wnd || wnd.closed) | 773 if (!wnd || wnd.closed) |
| 770 return; | 774 return; |
| 771 | 775 |
| 772 if (entry.type == Policy.type.OBJECT) | 776 if (entry.type == Policy.type.OBJECT) |
| 773 { | 777 { |
| 774 node.removeEventListener("mouseover", objectMouseEventHander, true); | 778 node.removeEventListener("mouseover", objectMouseEventHander, true); |
| 775 node.removeEventListener("mouseout", objectMouseEventHander, true); | 779 node.removeEventListener("mouseout", objectMouseEventHander, true); |
| 776 } | 780 } |
| 777 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true)
; | 781 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true)
; |
| 778 } | 782 } |
| OLD | NEW |