Commit Graph

46 Commits

Author SHA1 Message Date
tophf
4bc7b55b91 apply.js: a bad typo caused ghosts to linger 2017-04-18 12:46:28 +03:00
tophf
486d4258d3 Reinject styles on document-rewrite
uBlock-extra rewrites html of some sites known to have bad scripts. Such new documentElement doesn't have our styles so we need to detect this case by observing the parent document node non-recursively, meaning we don't add overhead to the normal browsing experience.
2017-04-18 12:46:26 +03:00
tophf
e4c8ff9ff1 TEMPORARY: restore style elements removed by hostile sites 2017-04-18 12:46:26 +03:00
tophf
0c6b74d999 Apply styles to more iframes
Previously we incorrectly assumed that each sub-element is present in addedNodes array, but actually we need to inspect each added node's children e.g. using the superfast getElementsByTagName.
2017-04-18 12:46:25 +03:00
tophf
64c830caa9 webNavigation.onReferenceFragmentUpdated instead of tabs.onUpdated
Also send a Do-It-Yourself to our built-in pages to fetch the styles directly which is faster because IPC messaging JSON-ifies everything internally
2017-04-18 12:46:25 +03:00
tophf
ac4a420e2b ESLint: customize the rules; fix the issues 2017-04-18 12:46:23 +03:00
tophf
49cba8cced apply.js: don't alter DOM stylesheet state if same 2017-04-18 12:43:31 +03:00
tophf
f4e689721a Improve style caching, cache requests too, add code:false mode
Previously, when a cache was invalidated and every tab/iframe issued a getStyles request, we previous needlessly accessed IndexedDB for each of these requests. It happened because 1) the global cachedStyles was created only at the end of the async DB-reading, 2) and each style record is retrieved asynchronously so the single threaded JS engine interleaved all these operations. It could easily span a few seconds when many tabs are open and you have like 100 styles.

Now, in getStyles: all requests issued while cachedStyles is being populated are queued and invoked at the end.

Now, in filterStyles: all requests are cached using the request's options combined in a string as a key. It also helps on each navigation because we monitor page loading process at different stages: before, when committed, history traversal, requesting applicable styles by a content script. Icon badge update also may issue a copy of the just issued request by one of the navigation listeners.

Now, the caches are invalidated smartly: style add/update/delete/toggle only purges filtering cache, and modifies style cache in-place without re-reading the entire IndexedDB.

Now, code:false mode for manage page that only needs style meta. It reduces the transferred message size 10-100 times thus reducing the overhead caused by to internal JSON-fication in the extensions API.

Also fast&direct getStylesSafe for own pages; code cosmetics
2017-04-18 12:43:28 +03:00
tophf
ac2a1a1c48 Orphaned content script case self-destruction tweaks#2 for apply.js 2017-03-19 05:24:10 +03:00
tophf
b77823c365 Orphaned content script case self-destruction tweaks for apply.js 2017-03-19 04:59:28 +03:00
tophf
71ea723728 Fixup 59e0f3f4: explicitly list our functions in self-destruct
Seems simpler and more robust. Otherwise Chrome spams console warnings about its webkit* aliases we touch.
2017-03-16 15:47:58 +03:00
tophf
59e0f3f45e Self-destruct orphaned content scripts 2017-03-16 13:32:13 +03:00
tophf
e658255c36 Reinject content scripts on install/update/enabling the extension
The injection code also runs outside of onInstalled event so we check first if a content script belonging to our execution context "generation" is already injected. This can happen on browser startup: the background page is loaded in several seconds after the normal web page tabs are loaded with our content script(s) already injected. The check itself is simply a "ping" message to each tab that should return true if the content script is alive and kicking.
2017-03-16 13:32:12 +03:00
tophf
6b49afaa48 Apply enable/disable state of style to popup itself 2017-03-14 15:18:58 +03:00
narcolepticinsomniac
3427c2d433 Rebrand style tags
https://github.com/schomery/stylish-chrome/issues/20#issuecomment-279298239
2017-02-13 01:17:53 -05:00
Jason
2973cac28f Switch to IndexedDB #167 2016-03-06 20:27:17 -06:00
Jason
a01bdf7b5a chrome.extension.onMessage -> chrome.runtime.onMessage 2016-01-30 18:06:04 -06:00
Jason
d957cd1b3b chrome.extension.sendMessage -> chrome.runtime.sendMessage 2016-01-30 17:08:10 -06:00
tophf
a1ab89e7ea Don't needlessly observe iframes while loading
because the browser starts loading iframes after DOMContentLoaded event anyway
2016-01-25 07:10:00 +03:00
tophf
3cf32048ed Apply styles to application/xml autogenerated pages 2016-01-25 07:07:43 +03:00
tophf
cbece7ce25 Bind only one DOMContentLoaded event 2015-12-26 21:23:34 +03:00
Jason Barnabe
7f0557df57 Merge pull request #143 from tophf/fixes
Fixes
2015-08-04 22:37:17 -05:00
tophf
92c2e743d6 Don't break gmail chat iframe by iframeObserver
Apparently some same-domain (!) iframes fail to load when their "contentDocument" is accessed (!)
2015-08-04 21:55:04 +03:00
tophf
99a956c383 Avoid flicker when updating applied styles 2015-08-03 08:25:59 +03:00
tophf
c60a21cf12 New Tab Page: fixup for icon, badge, popup style list 2015-05-21 17:45:06 +03:00
tophf
f765934316 Dim toolbar icon on unstyled tabs, regenerate icons 2015-05-21 17:38:02 +03:00
tophf
aafa909109 Make iframe observer faster
* Process dynamic frames on DOMContentLoaded
* Apply styles to iframes with srcdoc while loading
2015-05-21 17:16:09 +03:00
tophf
2faead9732 Normalize line endings in apply.js 2015-05-21 17:15:10 +03:00
tophf
539be4ce43 Code review & cosmetics 2015-05-05 23:42:38 +03:00
tophf
a0c5674f6f Wait for background page to load on Chrome startup
At startup Chrome lazy-loads extension's background page,
thus occasionally breaking apply.js and Stylish own pages
2015-05-05 21:36:16 +03:00
tophf
d4382d3f08 Apply global changes to popups 2015-04-07 20:07:45 +03:00
tophf
7c53643b19 Apply styles to own pages earlier to avoid flicker 2015-04-07 18:05:23 +03:00
hideheader
f45a6506be Add 'Disable all styles' to popup 2015-03-24 20:21:19 +03:00
Jason
d74dd20931 Fix pop-up when dealing with newtab #80 2015-03-23 13:56:11 -05:00
Jason
74d83e2640 Fix pushState logic for iframe changes #3+ 2015-03-05 12:02:26 -06:00
Jason
d151dd0303 Fix iframe mutation observer #3 2015-03-04 14:03:29 -06:00
Jason
908d769944 Manually apply styles to dynamic iframes #3 2015-03-03 10:48:29 -06:00
hideheader
c67c9d3f54 New message styleReplaceAll
`styleReplaceAll` removes all existing user styles, then applies the styles in the message payload.
2015-02-23 00:14:22 -05:00
Jason Barnabe
d879b5e0c4 Add option for smart indentation in editor 2015-02-08 22:02:08 -06:00
Jason Barnabe
ce0940c526 Apply style as far down the document as possible #15 2015-01-31 18:07:23 -06:00
Jason Barnabe
7747cab98f Original content is flickering before stylish applies the user style #15 2015-01-30 10:36:46 -06:00
Jason Barnabe
07d3cdda40 Switch to Linux line endings 2015-01-29 21:32:14 -06:00
Jason Barnabe
6489de0861 issue 5 Stylish does not affect all SVG 2013-11-19 13:37:09 -06:00
Jason Barnabe
9270dc1596 issue 44 Stop using deprecated Chrome APIs 2012-08-19 20:14:33 -05:00
Jason Barnabe
7df28a58db issue 31 some small perf improvements 2012-06-01 23:11:32 -05:00
Jason Barnabe
b019038f57 initial commit 2012-04-15 20:56:12 -05:00