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

Issue 29349811: Issue 4335 - Adblock Plus should forget pop-ups after the initial load (Closed)

Created:
Aug. 15, 2016, 6:28 p.m. by Wladimir Palant
Modified:
Aug. 17, 2016, 10:14 a.m.
Reviewers:
Thomas Greiner
Visibility:
Public.

Description

Unfortunately, this got more complicated than it should be. Three things happened here: 1) content-document-global-created notification replaced by document-element-inserted, the latter fires when the document is definitely initialized but still before any scripts run. As a result, the subject parameter is a document now, no longer a window - and it needs to be verified that we have a content window (as opposed to chrome windows which we should not touch). 2) Listening to DOMContentLoaded on pop-up documents to make sure that we "forget" them once that initial load happens. Any further loads should no longer be considered for pop-up blocking. 3) Since window.opener is still there even after the window loads, we cannot simply remove the window from _openers - the information will be recovered from window.opener when the user navigates to a different page. So we need to store a dummy value indicating "don`t touch" instead. Repository: hg.adblockplus.org/adblockplus

Patch Set 1 #

Patch Set 2 : Fixed wrong call for redirect blocking #

Total comments: 5

Patch Set 3 : Use Symbol for dummy value #

Unified diffs Side-by-side diffs Delta from patch set Stats (+43 lines, -19 lines) Patch
M lib/child/contentPolicy.js View 1 2 3 chunks +43 lines, -19 lines 0 comments Download

Messages

Total messages: 4
Wladimir Palant
Aug. 15, 2016, 6:28 p.m. (2016-08-15 18:28:10 UTC) #1
Thomas Greiner
https://codereview.adblockplus.org/29349811/diff/29349814/lib/child/contentPolicy.js File lib/child/contentPolicy.js (right): https://codereview.adblockplus.org/29349811/diff/29349814/lib/child/contentPolicy.js#newcode315 lib/child/contentPolicy.js:315: _alreadyLoaded: {}, Detail: I'd rather use `Symbol` for that ...
Aug. 16, 2016, 9:50 a.m. (2016-08-16 09:50:25 UTC) #2
Wladimir Palant
https://codereview.adblockplus.org/29349811/diff/29349814/lib/child/contentPolicy.js File lib/child/contentPolicy.js (right): https://codereview.adblockplus.org/29349811/diff/29349814/lib/child/contentPolicy.js#newcode315 lib/child/contentPolicy.js:315: _alreadyLoaded: {}, On 2016/08/16 09:50:25, Thomas Greiner wrote: > ...
Aug. 16, 2016, 10:36 a.m. (2016-08-16 10:36:05 UTC) #3
Thomas Greiner
Aug. 16, 2016, 11:31 a.m. (2016-08-16 11:31:54 UTC) #4
LGTM

https://codereview.adblockplus.org/29349811/diff/29349814/lib/child/contentPo...
File lib/child/contentPolicy.js (right):

https://codereview.adblockplus.org/29349811/diff/29349814/lib/child/contentPo...
lib/child/contentPolicy.js:358: let forgetPopup = event =>
On 2016/08/16 10:36:05, Wladimir Palant wrote:
> On 2016/08/16 09:50:25, Thomas Greiner wrote:
> > The issue I'm seeing with this approach is that a non-user initiated
> navigation
> > after the DOM creation (e.g. an asynchronously executed JavaScript redirect)
> > would no longer be caught by `$popup` filters.
> 
> Yes, we discussed that yesterday briefly. A website can always disguise
> automated navigation as a user action - e.g. us adding a timeout here won't
help
> much. On the other hand, going with "once a pop-up - always a pop-up" is a
> perfect recipe for weird false positives and confusing behavior (see steps to
> reproduce in the issue for example). So this needs to be addressed via
> https://issues.adblockplus.org/ticket/2095, a generic mechanism to disallow
> certain navigation, not limited to pop-ups.

I agree, that approach makes more sense.

Powered by Google App Engine
This is Rietveld