Left: | ||
Right: |
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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
489 let result = Cr.NS_OK; | 489 let result = Cr.NS_OK; |
490 try | 490 try |
491 { | 491 { |
492 // nsILoadInfo.contentPolicyType was introduced in Gecko 35, then | 492 // nsILoadInfo.contentPolicyType was introduced in Gecko 35, then |
493 // renamed to nsILoadInfo.externalContentPolicyType in Gecko 44. | 493 // renamed to nsILoadInfo.externalContentPolicyType in Gecko 44. |
494 let loadInfo = oldChannel.loadInfo; | 494 let loadInfo = oldChannel.loadInfo; |
495 let contentType = loadInfo.externalContentPolicyType || loadInfo.contentPo licyType; | 495 let contentType = loadInfo.externalContentPolicyType || loadInfo.contentPo licyType; |
496 if (!contentType) | 496 if (!contentType) |
497 return; | 497 return; |
498 | 498 |
499 let newLocation = null; | |
500 try | |
501 { | |
502 newLocation = newChannel.URI; | |
503 } catch(e2) {} | |
504 if (!newLocation) | |
505 return; | |
506 | |
507 let wnd = Utils.getRequestWindow(newChannel); | 499 let wnd = Utils.getRequestWindow(newChannel); |
508 if (!wnd) | 500 if (!wnd) |
509 return; | 501 return; |
510 | 502 |
511 if (contentType == Policy.type.POPUP && wnd.opener) | 503 if (contentType == Ci.nsIContentPolicy.TYPE_DOCUMENT) |
512 { | 504 { |
513 // Popups are initiated by their opener, not their own window. | 505 if (wnd.history.length <= 1 && wnd.opener) |
514 wnd = wnd.opener; | 506 { |
507 // Special treatment for pop-up windows. Note that we might not have | |
508 // seen the original channel yet because the redirect happened before | |
509 // the async code in observe() had a chance to run. | |
510 this.observe(wnd, "content-document-global-created", null, oldChannel. URI); | |
511 this.observe(wnd, "content-document-global-created", null, newChannel. URI); | |
512 } | |
tschuster
2015/11/05 15:27:18
I think your comment about this patch set would he
Wladimir Palant
2015/11/05 15:51:59
Done.
| |
513 return; | |
515 } | 514 } |
516 | 515 |
517 if (!Policy.processNode(wnd, wnd.document, contentType, newLocation, false )) | 516 if (!Policy.processNode(wnd, wnd.document, contentType, newChannel.URI, fa lse)) |
518 result = Cr.NS_BINDING_ABORTED; | 517 result = Cr.NS_BINDING_ABORTED; |
519 } | 518 } |
520 catch (e) | 519 catch (e) |
521 { | 520 { |
522 // We shouldn't throw exceptions here - this will prevent the redirect. | 521 // We shouldn't throw exceptions here - this will prevent the redirect. |
523 Cu.reportError(e); | 522 Cu.reportError(e); |
524 } | 523 } |
525 finally | 524 finally |
526 { | 525 { |
527 callback.onRedirectVerifyCallback(result); | 526 callback.onRedirectVerifyCallback(result); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
726 if (!wnd || wnd.closed) | 725 if (!wnd || wnd.closed) |
727 return; | 726 return; |
728 | 727 |
729 if (entry.type == Policy.type.OBJECT) | 728 if (entry.type == Policy.type.OBJECT) |
730 { | 729 { |
731 node.removeEventListener("mouseover", objectMouseEventHander, true); | 730 node.removeEventListener("mouseover", objectMouseEventHander, true); |
732 node.removeEventListener("mouseout", objectMouseEventHander, true); | 731 node.removeEventListener("mouseout", objectMouseEventHander, true); |
733 } | 732 } |
734 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ; | 733 Policy.processNode(wnd, node, entry.type, Utils.makeURI(entry.location), true) ; |
735 } | 734 } |
OLD | NEW |