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

Side by Side Diff: lib/contentPolicy.js

Issue 29329404: Issue 443 - Fix blocking pop-ups after redirect (Closed)
Patch Set: Created Oct. 26, 2015, 8:28 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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)
Wladimir Palant 2015/10/26 20:50:26 This relies on the changes from https://codereview
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld