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

Issue 29410607: Issue 5090 - Use user stylesheets for element hiding if possible (Closed)

Created:
April 12, 2017, 10:59 a.m. by Manish Jethani
Modified:
July 17, 2017, 3:33 p.m.
Visibility:
Public.

Description

If the chrome.tabs.insertCSS API is available and supports "user" stylesheets (Firefox 53), we use it instead of injecting the CSS directly into the page.

Patch Set 1 #

Total comments: 8

Patch Set 2 : Use chrome.tabs.insertCSS instead #

Total comments: 4

Patch Set 3 : Add comment explaining when we inject styles #

Total comments: 3

Patch Set 4 : Check platform and platform version for user stylesheet support #

Total comments: 6

Patch Set 5 : Remove try/catch #

Total comments: 11

Patch Set 6 : Move get-selectors and hide-elements to elemHideHelper #

Patch Set 7 : Use feature detection #

Total comments: 21

Patch Set 8 : Make hideElements return a promise #

Total comments: 10

Patch Set 9 : Change inject to insertMode #

Total comments: 1

Patch Set 10 : Make hideElements synchronous #

Patch Set 11 : Simplify addSelectors #

Patch Set 12 : Further simplify addSelectors #

Total comments: 6

Patch Set 13 : Update message and file names #

Unified diffs Side-by-side diffs Delta from patch set Stats (+131 lines, -36 lines) Patch
M background.js View 1 2 3 4 5 6 7 1 chunk +0 lines, -29 lines 0 comments Download
M ext/background.js View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M include.preload.js View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +35 lines, -6 lines 0 comments Download
A lib/cssInjection.js View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +93 lines, -0 lines 0 comments Download
M metadata.chrome View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +2 lines, -1 line 0 comments Download

Messages

Total messages: 43
Manish Jethani
Patch Set 1 If the browser.tabs.insertCSS API is available and supports "user" stylesheets (Firefox 53), ...
April 12, 2017, 11:03 a.m. (2017-04-12 11:03:49 UTC) #1
Sebastian Noack
https://codereview.adblockplus.org/29410607/diff/29410608/background.js File background.js (right): https://codereview.adblockplus.org/29410607/diff/29410608/background.js#newcode51 background.js:51: if (!tryInsertCSS) Chrome and Firefox should use the same ...
April 12, 2017, 12:21 p.m. (2017-04-12 12:21:19 UTC) #2
Wladimir Palant
https://codereview.adblockplus.org/29410607/diff/29410608/background.js File background.js (right): https://codereview.adblockplus.org/29410607/diff/29410608/background.js#newcode71 background.js:71: port.on("hide-elements", (msg, sender) => On 2017/04/12 12:21:18, Sebastian Noack ...
April 12, 2017, 12:25 p.m. (2017-04-12 12:25:56 UTC) #3
Manish Jethani
https://codereview.adblockplus.org/29410607/diff/29410608/background.js File background.js (right): https://codereview.adblockplus.org/29410607/diff/29410608/background.js#newcode51 background.js:51: if (!tryInsertCSS) On 2017/04/12 12:21:18, Sebastian Noack wrote: > ...
April 12, 2017, 12:32 p.m. (2017-04-12 12:32:30 UTC) #4
Sebastian Noack
https://codereview.adblockplus.org/29410607/diff/29410608/background.js File background.js (right): https://codereview.adblockplus.org/29410607/diff/29410608/background.js#newcode51 background.js:51: if (!tryInsertCSS) On 2017/04/12 12:32:30, Manish Jethani wrote: > ...
April 12, 2017, 12:54 p.m. (2017-04-12 12:54:43 UTC) #5
Wladimir Palant
https://codereview.adblockplus.org/29410607/diff/29410608/background.js File background.js (right): https://codereview.adblockplus.org/29410607/diff/29410608/background.js#newcode51 background.js:51: if (!tryInsertCSS) On 2017/04/12 12:32:30, Manish Jethani wrote: > ...
April 12, 2017, 1:37 p.m. (2017-04-12 13:37:57 UTC) #6
Manish Jethani
https://codereview.adblockplus.org/29410607/diff/29410608/background.js File background.js (right): https://codereview.adblockplus.org/29410607/diff/29410608/background.js#newcode51 background.js:51: if (!tryInsertCSS) On 2017/04/12 13:37:57, Wladimir Palant wrote: > ...
April 12, 2017, 2:27 p.m. (2017-04-12 14:27:01 UTC) #7
Manish Jethani
Patch Set 2: Use chrome.tabs.insertCSS instead
April 12, 2017, 2:43 p.m. (2017-04-12 14:43:29 UTC) #8
kzar
Your changes so far look really good, glad to have you. Sorry my slowness, but ...
April 13, 2017, 7:56 a.m. (2017-04-13 07:56:25 UTC) #9
Manish Jethani
Patch Set 3: Add comment explaining when we inject styles > - I guess the ...
April 18, 2017, 9:25 a.m. (2017-04-18 09:25:05 UTC) #10
Manish Jethani
On 2017/04/12 12:54:43, Sebastian Noack wrote: > Keep, in mind that with -abp-selector/:has there will ...
April 18, 2017, 9:34 a.m. (2017-04-18 09:34:58 UTC) #11
kzar
On 2017/04/18 09:25:05, Manish Jethani wrote: > Patch Set 3: Add comment explaining when we ...
April 20, 2017, 6:17 a.m. (2017-04-20 06:17:15 UTC) #12
Manish Jethani
On 2017/04/20 06:17:15, kzar wrote: > On 2017/04/18 09:25:05, Manish Jethani wrote: > > Patch ...
April 20, 2017, 12:49 p.m. (2017-04-20 12:49:32 UTC) #13
Manish Jethani
Patch Set 4: Check platform and platform version for user stylesheet support https://codereview.adblockplus.org/29410607/diff/29416561/background.js File background.js ...
April 20, 2017, 12:50 p.m. (2017-04-20 12:50:32 UTC) #14
kzar
https://codereview.adblockplus.org/29410607/diff/29416561/background.js File background.js (right): https://codereview.adblockplus.org/29410607/diff/29416561/background.js#newcode58 background.js:58: if (error && /\bError processing cssOrigin\b/.test(error.message) != -1) On ...
April 21, 2017, 11:20 a.m. (2017-04-21 11:20:22 UTC) #15
kzar
https://codereview.adblockplus.org/29410607/diff/29418604/lib/css.js File lib/css.js (right): https://codereview.adblockplus.org/29410607/diff/29418604/lib/css.js#newcode51 lib/css.js:51: { On 2017/04/21 11:20:22, kzar wrote: > Nit: We'd ...
April 21, 2017, 11:21 a.m. (2017-04-21 11:21:57 UTC) #16
Manish Jethani
On 2017/04/21 11:20:22, kzar wrote: > Nice, looks good. Could you update the issue description ...
April 21, 2017, 1:35 p.m. (2017-04-21 13:35:52 UTC) #17
Manish Jethani
Patch Set 5: Remove try/catch https://codereview.adblockplus.org/29410607/diff/29418604/lib/css.js File lib/css.js (right): https://codereview.adblockplus.org/29410607/diff/29418604/lib/css.js#newcode48 lib/css.js:48: try On 2017/04/21 11:20:22, ...
April 21, 2017, 1:39 p.m. (2017-04-21 13:39:33 UTC) #18
kzar
Otherwise LGTM https://codereview.adblockplus.org/29410607/diff/29418604/lib/css.js File lib/css.js (right): https://codereview.adblockplus.org/29410607/diff/29418604/lib/css.js#newcode51 lib/css.js:51: { On 2017/04/21 13:39:32, Manish Jethani wrote: ...
April 21, 2017, 2:36 p.m. (2017-04-21 14:36:51 UTC) #19
Sebastian Noack
https://codereview.adblockplus.org/29410607/diff/29419615/background.js File background.js (left): https://codereview.adblockplus.org/29410607/diff/29419615/background.js#oldcode48 background.js:48: return {selectors, trace}; How about moving this message handler ...
April 29, 2017, 10:11 p.m. (2017-04-29 22:11:04 UTC) #20
Manish Jethani
Patch Set 6: Move get-selectors and hide-elements to elemHideHelper Sorry, you'll have to look at ...
May 1, 2017, 11:18 p.m. (2017-05-01 23:18:06 UTC) #21
kzar
LGTM
May 10, 2017, 8:43 a.m. (2017-05-10 08:43:32 UTC) #22
Wladimir Palant
https://codereview.adblockplus.org/29410607/diff/29419615/lib/css.js File lib/css.js (right): https://codereview.adblockplus.org/29410607/diff/29419615/lib/css.js#newcode30 lib/css.js:30: exports.userStylesheetsSupported = info.platform == "gecko" && On 2017/05/01 23:18:05, ...
May 17, 2017, 11:50 a.m. (2017-05-17 11:50:16 UTC) #23
kzar
On 2017/05/17 11:50:16, Wladimir Palant wrote: > Given that the values provided by the info ...
May 17, 2017, 11:55 a.m. (2017-05-17 11:55:02 UTC) #24
Sebastian Noack
On 2017/05/17 11:55:02, kzar wrote: > On 2017/05/17 11:50:16, Wladimir Palant wrote: > > Given ...
May 17, 2017, 12:07 p.m. (2017-05-17 12:07:44 UTC) #25
Manish Jethani
On 2017/05/17 11:50:16, Wladimir Palant wrote: > Given that the values provided by the info ...
May 18, 2017, 1:55 a.m. (2017-05-18 01:55:54 UTC) #26
Manish Jethani
Patch Set 7: Use feature detection https://codereview.adblockplus.org/29410607/diff/29440618/lib/elemHideHelper.js File lib/elemHideHelper.js (right): https://codereview.adblockplus.org/29410607/diff/29440618/lib/elemHideHelper.js#newcode55 lib/elemHideHelper.js:55: callback(error); Doing this ...
May 18, 2017, 2:25 a.m. (2017-05-18 02:25:23 UTC) #27
Sebastian Noack
https://codereview.adblockplus.org/29410607/diff/29440618/include.preload.js File include.preload.js (right): https://codereview.adblockplus.org/29410607/diff/29440618/include.preload.js#newcode600 include.preload.js:600: + addSelectors(selectors, filters, {inject, traceOnly} = {}) Any reason ...
May 24, 2017, 8:31 a.m. (2017-05-24 08:31:42 UTC) #28
Manish Jethani
Patch Set 8: Make hideElement return a promise Note: I've used hg review now, but ...
May 24, 2017, 5:13 p.m. (2017-05-24 17:13:35 UTC) #29
Sebastian Noack
https://codereview.adblockplus.org/29410607/diff/29440618/include.preload.js File include.preload.js (right): https://codereview.adblockplus.org/29410607/diff/29440618/include.preload.js#newcode600 include.preload.js:600: + addSelectors(selectors, filters, {inject, traceOnly} = {}) On 2017/05/24 ...
May 24, 2017, 6:14 p.m. (2017-05-24 18:14:06 UTC) #30
Manish Jethani
Patch Set 9: Change inject to insertMode Comments inline. https://codereview.adblockplus.org/29410607/diff/29440618/include.preload.js File include.preload.js (right): https://codereview.adblockplus.org/29410607/diff/29440618/include.preload.js#newcode600 include.preload.js:600: ...
May 25, 2017, 2:52 a.m. (2017-05-25 02:52:27 UTC) #31
Sebastian Noack
https://codereview.adblockplus.org/29410607/diff/29440618/include.preload.js File include.preload.js (right): https://codereview.adblockplus.org/29410607/diff/29440618/include.preload.js#newcode607 include.preload.js:607: + if (this.tracer) On 2017/05/25 02:52:25, Manish Jethani wrote: ...
May 30, 2017, 3:50 p.m. (2017-05-30 15:50:33 UTC) #32
Manish Jethani
https://codereview.adblockplus.org/29410607/diff/29440618/include.preload.js File include.preload.js (right): https://codereview.adblockplus.org/29410607/diff/29440618/include.preload.js#newcode607 include.preload.js:607: + if (this.tracer) On 2017/05/30 15:50:30, Sebastian Noack wrote: ...
May 31, 2017, 6:21 a.m. (2017-05-31 06:21:39 UTC) #33
Sebastian Noack
https://codereview.adblockplus.org/29410607/diff/29440618/include.preload.js File include.preload.js (right): https://codereview.adblockplus.org/29410607/diff/29440618/include.preload.js#newcode607 include.preload.js:607: + if (this.tracer) On 2017/05/31 06:21:38, Manish Jethani wrote: ...
May 31, 2017, 11:13 a.m. (2017-05-31 11:13:30 UTC) #34
Manish Jethani
https://codereview.adblockplus.org/29410607/diff/29440618/include.preload.js File include.preload.js (right): https://codereview.adblockplus.org/29410607/diff/29440618/include.preload.js#newcode607 include.preload.js:607: + if (this.tracer) On 2017/05/31 11:13:29, Sebastian Noack wrote: ...
May 31, 2017, 2:41 p.m. (2017-05-31 14:41:15 UTC) #35
Manish Jethani
Patch Set 10: Make hideElements synchronous
June 1, 2017, 9:52 p.m. (2017-06-01 21:52:48 UTC) #36
Manish Jethani
Patch Set 11: Simplify addSelectors I got rid of the extra option to addSelectors here. ...
June 2, 2017, 3:42 a.m. (2017-06-02 03:42:19 UTC) #37
Manish Jethani
On 2017/06/02 03:42:19, Manish Jethani wrote: > Patch Set 11: Simplify addSelectors > > I ...
June 2, 2017, 3:44 a.m. (2017-06-02 03:44:38 UTC) #38
kzar
LGTM, do you want to take another look at this Sebastian? https://codereview.adblockplus.org/29410607/diff/29453760/include.preload.js File include.preload.js (right): ...
July 7, 2017, 2:07 p.m. (2017-07-07 14:07:45 UTC) #39
Sebastian Noack
https://codereview.adblockplus.org/29410607/diff/29453760/lib/elemHideHelper.js File lib/elemHideHelper.js (right): https://codereview.adblockplus.org/29410607/diff/29453760/lib/elemHideHelper.js#newcode57 lib/elemHideHelper.js:57: port.on("get-selectors", (msg, sender) => In new code we use ...
July 7, 2017, 4:16 p.m. (2017-07-07 16:16:11 UTC) #40
Manish Jethani
Patch Set 13: Update message and file names https://codereview.adblockplus.org/29410607/diff/29453760/include.preload.js File include.preload.js (right): https://codereview.adblockplus.org/29410607/diff/29453760/include.preload.js#newcode666 include.preload.js:666: + ...
July 9, 2017, 12:09 p.m. (2017-07-09 12:09:39 UTC) #41
kzar
LGTM, but please wait for Sebastian to approve this one.
July 10, 2017, 12:36 p.m. (2017-07-10 12:36:23 UTC) #42
Sebastian Noack
July 17, 2017, 9:03 a.m. (2017-07-17 09:03:06 UTC) #43
LGTM

Powered by Google App Engine
This is Rietveld