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

Issue 4883433876619264: Issue 2217 - Adapt for content scripts running in about:blank frames (Closed)

Created:
March 25, 2015, 3:15 p.m. by Sebastian Noack
Modified:
March 27, 2015, 9:26 a.m.
Reviewers:
kzar
CC:
Wladimir Palant
Visibility:
Public.

Description

Issue 2217 - Adapt for content scripts running in about:blank frames

Patch Set 1 #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+26 lines, -24 lines) Patch
M include.preload.js View 3 chunks +26 lines, -24 lines 5 comments Download

Messages

Total messages: 4
Sebastian Noack
March 25, 2015, 3:17 p.m. (2015-03-25 15:17:43 UTC) #1
kzar
http://codereview.adblockplus.org/4883433876619264/diff/5629499534213120/include.preload.js File include.preload.js (right): http://codereview.adblockplus.org/4883433876619264/diff/5629499534213120/include.preload.js#newcode269 include.preload.js:269: if (contentDocument instanceof contentWindow.HTMLDocument) Perhaps we should check that ...
March 26, 2015, 12:07 p.m. (2015-03-26 12:07:57 UTC) #2
Sebastian Noack
http://codereview.adblockplus.org/4883433876619264/diff/5629499534213120/include.preload.js File include.preload.js (right): http://codereview.adblockplus.org/4883433876619264/diff/5629499534213120/include.preload.js#newcode269 include.preload.js:269: if (contentDocument instanceof contentWindow.HTMLDocument) On 2015/03/26 12:07:57, kzar wrote: ...
March 26, 2015, 1:41 p.m. (2015-03-26 13:41:19 UTC) #3
kzar
March 26, 2015, 2:14 p.m. (2015-03-26 14:14:58 UTC) #4
LGTM

http://codereview.adblockplus.org/4883433876619264/diff/5629499534213120/incl...
File include.preload.js (right):

http://codereview.adblockplus.org/4883433876619264/diff/5629499534213120/incl...
include.preload.js:283:
[].forEach.call(contentDocument.querySelectorAll(Object.keys(typeMap).join(",")),
checkCollapse);
On 2015/03/26 13:41:19, Sebastian Noack wrote:
> On 2015/03/26 12:07:57, kzar wrote:
> > Couldn't we put this forEach loop under the above `if (!("init" in
> > contentWindow))` clause? I don't understand what assigning and checking the
> > collapsing variable adds over just checking that the init function exists.
I'm
> > probably missing something.
> 
> We are dealing two different issues here:
> 
> 1. The content script isn't running in the frame. Hence we have to manually
> initialize element hiding there.
> 
> 2. The frame doesn't dispatch load/error events for its elements. So we have
to
> check for all elements in the loaded frame to potentially collapse them. This
> Chrome bug isn't fixed yet, and occurs also for frames running our content
> scripts. Therfore this workaround must be performed regardless of the one
above.

OK, thanks for explaining.

Powered by Google App Engine
This is Rietveld