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

Issue 5464830253203456: Refactored the abstraction layer to address prerendered pages on Safari caused by leaky abstraction (Closed)

Created:
Feb. 22, 2014, 10:45 a.m. by Sebastian Noack
Modified:
April 12, 2014, 8:32 a.m.
CC:
Thomas Greiner
Visibility:
Public.

Description

Prerendered pages on Safari 7 are exposed with the same SafariBrowserTab object as the page currently shown in the tab. This leads to a bunch of issues on Safari 7 at the moment, most notable messing up the ad counter. This is caused by a leaky abstraction. We just map SafariBrowserTab objects to tabs in the abstraction layer. While we do something similar on Chrome, prerendered pages are already exposed as separate tabs by Chrome's API. So in order to fix this, we also must expose prerendered pages on Safari separately. Since our top-level code isn't actually interested in tabs and windows, but in the pages running inside them, I refactored the abstraction layer and moved from a mindset based on windows and tabs to a mindset based on pages.

Patch Set 1 #

Total comments: 21

Patch Set 2 : Rebased and addressed comments #

Patch Set 3 : Fixed issue with element collapsing introduced while rebasing #

Total comments: 11

Patch Set 4 : Addressed comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1038 lines, -1336 lines) Patch
M background.js View 1 2 10 chunks +44 lines, -57 lines 0 comments Download
M chrome/ext/background.js View 1 2 3 9 chunks +124 lines, -356 lines 0 comments Download
M chrome/ext/common.js View 1 chunk +34 lines, -85 lines 0 comments Download
M chrome/ext/content.js View 1 chunk +1 line, -1 line 0 comments Download
M chrome/ext/popup.js View 1 chunk +8 lines, -12 lines 0 comments Download
A ext/background.js View 1 1 chunk +65 lines, -0 lines 0 comments Download
A ext/common.js View 1 1 chunk +51 lines, -0 lines 0 comments Download
M iconAnimation.js View 1 2 3 4 chunks +17 lines, -44 lines 0 comments Download
M lib/stats.js View 2 chunks +23 lines, -42 lines 0 comments Download
M lib/whitelisting.js View 3 chunks +8 lines, -8 lines 0 comments Download
M metadata.chrome View 1 1 chunk +1 line, -1 line 0 comments Download
M metadata.common View 1 2 chunks +2 lines, -2 lines 0 comments Download
M metadata.safari View 1 2 chunks +2 lines, -2 lines 0 comments Download
M notification.js View 1 1 chunk +1 line, -1 line 0 comments Download
M popup.js View 1 6 chunks +27 lines, -32 lines 0 comments Download
M popupBlocker.js View 1 chunk +3 lines, -3 lines 0 comments Download
M safari/ext/background.js View 1 2 3 11 chunks +367 lines, -412 lines 0 comments Download
M safari/ext/common.js View 1 2 3 3 chunks +101 lines, -134 lines 0 comments Download
M safari/ext/content.js View 1 2 4 chunks +143 lines, -122 lines 0 comments Download
M safari/ext/popup.js View 1 1 chunk +2 lines, -4 lines 0 comments Download
M stats.js View 4 chunks +8 lines, -12 lines 0 comments Download
M webrequest.js View 1 4 chunks +6 lines, -6 lines 0 comments Download

Messages

Total messages: 6
Sebastian Noack
Feb. 22, 2014, 11:37 a.m. (2014-02-22 11:37:00 UTC) #1
Wladimir Palant
Only got to safari/ext/background.js today, posting the comments so far. http://codereview.adblockplus.org/5464830253203456/diff/5629499534213120/background.js File background.js (right): http://codereview.adblockplus.org/5464830253203456/diff/5629499534213120/background.js#newcode256 ...
April 4, 2014, 2 p.m. (2014-04-04 14:00:34 UTC) #2
Sebastian Noack
http://codereview.adblockplus.org/5464830253203456/diff/5629499534213120/background.js File background.js (right): http://codereview.adblockplus.org/5464830253203456/diff/5629499534213120/background.js#newcode256 background.js:256: ext.pages.query({lastFocusedWindow: true}, function(pages) On 2014/04/04 14:00:35, Wladimir Palant wrote: ...
April 7, 2014, 1:15 p.m. (2014-04-07 13:15:25 UTC) #3
Wladimir Palant
http://codereview.adblockplus.org/5464830253203456/diff/5629499534213120/chrome/ext/background.js File chrome/ext/background.js (right): http://codereview.adblockplus.org/5464830253203456/diff/5629499534213120/chrome/ext/background.js#newcode104 chrome/ext/background.js:104: if (visibleWindow != (win.state != "minimized")) On 2014/04/07 13:15:25, ...
April 11, 2014, 1:02 p.m. (2014-04-11 13:02:35 UTC) #4
Sebastian Noack
http://codereview.adblockplus.org/5464830253203456/diff/5629499534213120/chrome/ext/background.js File chrome/ext/background.js (right): http://codereview.adblockplus.org/5464830253203456/diff/5629499534213120/chrome/ext/background.js#newcode104 chrome/ext/background.js:104: if (visibleWindow != (win.state != "minimized")) On 2014/04/11 13:02:35, ...
April 11, 2014, 2:47 p.m. (2014-04-11 14:47:44 UTC) #5
Wladimir Palant
April 11, 2014, 6:31 p.m. (2014-04-11 18:31:19 UTC) #6
LGTM

http://codereview.adblockplus.org/5464830253203456/diff/5634387206995968/safa...
File safari/ext/common.js (right):

http://codereview.adblockplus.org/5464830253203456/diff/5634387206995968/safa...
safari/ext/common.js:166: if (substitutions && substitutions.constructor ==
Array)
On 2014/04/11 14:47:45, Sebastian Noack wrote:
> However now where I know a lot more about JavaScript that approach seems weird
> to me and I don't understand how this answer got over 600 points. So I skipped
> the string conversion, and directly checked for the constructor.

The only case where instanceof Array is problematic is when dealing with
different JavaScript contexts - each window and frame has its own Array
constructor and an array from another window cannot be checked against your
constructor. Not really something that is a concern here however.

Powered by Google App Engine
This is Rietveld