1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-06-03 02:44:57 +12:00
Commit graph

663 commits

Author SHA1 Message Date
Deathamns 0bc67a8819 Drop js-loader, updates from gorhill/uBlock/master 2015-04-10 19:37:25 -04:00
Deathamns d150eb6d1c Use different page navigation detection for Safari
The beforeNavigate event wasn't reliable (sometimes didn't fire, sometimes
fired unnecessary when opening a link with the middle click - which had a
workaround previously, but that's also removed by this commit).

When the event didn't fire, the bindTabToPageStats method didn't run,
and the requests related to the tab weren't blocked.
2015-04-10 19:37:25 -04:00
Deathamns ed1e23cfb1 Site-patching possibility for Safari
Safari's extension API doesn't provide a way to intercept requests
initiated by plugins, so those cases need special care (or at least the
popular sites).

This commit adds a new JS file (sitepatch-safari.js), which will store the
patches (if it's possible to create one) for specific sites.

As an example, this commit includes a technique for removing in-video ads
from YouTube videos.
2015-04-10 19:37:25 -04:00
Deathamns 192053ae99 document.head isn't always available in Safari 2015-04-10 19:37:25 -04:00
Deathamns 4df265b15f Badge number sometimes disappeared in Safari 2015-04-10 19:37:25 -04:00
Deathamns bc980a3522 Implement pop-up blocking for Safari
It works similarly to the xhr intercepting, except here the window.open
global function is being overridden.
Note that it could only work if the site's Content Security Policy allows
inline scripts, and the script on the webpage doesn't have a copy of the
original window.open function (it can happen only if the page has an
inline script in its head element, where the reference to the original
function can be obtained - likely this cannot be prevented in Safari).
2015-04-10 19:37:25 -04:00
Deathamns 9313a7f16b Element picker tweaks
- Indentation whitespace fixes.
- Use built-in getBoundingClientRect() function instead of self-made.
- Use built-in DOM API for manipulating the class attributes instead of
  altering the className property.
- Add pointer-events: none to the svgRoot when using
  document.elementFromPoint(), but if the browser (older Safari for
  example) doesn't take the pointer-events into account, then fall back to
  display: none.
- Initiate every part of the picker at the same time; when the message is
  received from the background. This way the selected element will have
  the red overlay immediately, instead of showing first the black overlay,
  then a few milliseconds later the red.
2015-04-10 19:37:25 -04:00
Deathamns c56d3ca717 Avoid using Chrome's @@bidi_* type i18n messages
... for the sake of portability.

When including vapi-common.js in an HTML file, then the body element there
will have a "dir" attribute filled with the current locale's direction
(ltr or rtl).

The following languages are considered right-to-left: ar, he, fa, ps, ur.
Everything else is left-to-right.

After the "dir" attribute is set, we can decide in CSS which elements
should have different styling for rtl languages (e.g., body[dir=rtl] #id).
2015-04-10 19:37:25 -04:00
Deathamns f514bf0835 Workaround for a messaging bug in Safari 2015-04-10 19:37:25 -04:00
Deathamns 5d08b448b0 Use HTML5 download instead of extension API
Benefits:
- Cross browser solution (however only for relatively new browsers)
- Doesn't need extra permission in Chrome

If the browser doesn't suppor the download attribute, then a new tab will
be opened with the exported data.

Other changes:
- Start the download only if the data is not empty (previously the
  download started anyway)
- Reorder code in vapi-client.js for Safari, so unnecessary code doesn't
  run on extension pages
2015-04-10 19:37:25 -04:00
Deathamns 34e1df3218 Script injection, element picker, messaging
- Add script injection to vAPI, plus a raw implementation for Safari
  (element-picker.js requires it)
- Tweak element picker to work with Safari
- Revert a change from previous commit: element-picker.js' background
  message handler (since actually it can have its own messaging channel)
- Don't send "undefined" reponses from background to content
2015-04-10 19:37:25 -04:00
Deathamns 4072264fa8 Add .jshintrc, and use the "use strict" directive
.jshintrc's otion-set is a personal choice, merely a suggestion.
Beside that, it includes some common globals for specific browsers, so
there's no need to set the globals in every .js file.

In order to force strict coding, "use strict" directive was added into
every .js file.
2015-04-10 19:37:25 -04:00
Deathamns a04a788eea Work on vendor API abstraction, and near complete Safari support 2015-04-10 19:37:25 -04:00
Deathamns fccb781950 Ports cleanup
- Remove duplicate platform specific (from src/) and other unnecessary
  files
- Fix and update vapi-*.js files for Safari
- Add tools/make-safari.sh
- Move js/vapi-appinfo.js to meta/ (so, every vendor specific file will be
  at the same location)
2015-04-10 19:33:59 -04:00
Raymond Hill bd5492654f give specific message handlers priority over default one 2015-04-10 19:33:59 -04:00
Deathamns c3178cd442 Only top window should have type main_frame 2015-04-10 19:33:59 -04:00
Deathamns 8eb76e880c Building extension files
Adds possibility to build extension files (Chrome and Safari) from
command line.

To run from the project directory:
python tools/build.py [meta]

If the optional `meta` argument is set, then only the manifest and
language files are uptated.
Without that everything is being built (extension files too) into the
`dist/build/version_number` folder.

For Chrome there will be two files, a crx, and a .zip file which
includes the key.pem private key (so this must not be shared,
it's just a bit help for publishing it to the Chrome Web Store).

Beside the extension files, update-files are generated too (for self
hosting - Safari needs it).
2015-04-10 19:33:59 -04:00
Deathamns 29eabd44fd Fix messaging for Safari 2015-04-10 19:33:59 -04:00
Deathamns 872a478f91 Preferences button for Safari
Brings back the possibility to click a checkbox which opens the extension
settings from Safari's Preferences/Extensions.
2015-04-10 19:33:59 -04:00
Deathamns 3d535c6c69 Messaging fixes
Checking the message name (and connectorId) is mandatory for Safari,
because when the background page sends a response back to a document,
then all the frames in its owner tab will receive the exact same
message, which could confuse the script in some cases.
2015-04-10 19:33:59 -04:00
Deathamns bda4dba902 Use different page navigation detection for Safari
The beforeNavigate event wasn't reliable (sometimes didn't fire, sometimes
fired unnecessary when opening a link with the middle click - which had a
workaround previously, but that's also removed by this commit).

When the event didn't fire, the bindTabToPageStats method didn't run,
and the requests related to the tab weren't blocked.
2015-04-10 19:33:59 -04:00
Deathamns ceb18d4629 Site-patching possibility for Safari
Safari's extension API doesn't provide a way to intercept requests
initiated by plugins, so those cases need special care (or at least the
popular sites).

This commit adds a new JS file (sitepatch-safari.js), which will store the
patches (if it's possible to create one) for specific sites.

As an example, this commit includes a technique for removing in-video ads
from YouTube videos.
2015-04-10 19:33:59 -04:00
Deathamns c0b1565131 Badge number sometimes disappeared in Safari 2015-04-10 19:33:59 -04:00
Deathamns 31f9683d9f Implement pop-up blocking for Safari
It works similarly to the xhr intercepting, except here the window.open
global function is being overridden.
Note that it could only work if the site's Content Security Policy allows
inline scripts, and the script on the webpage doesn't have a copy of the
original window.open function (it can happen only if the page has an
inline script in its head element, where the reference to the original
function can be obtained - likely this cannot be prevented in Safari).
2015-04-10 19:33:59 -04:00
Deathamns 1be99cf58e Remove unnecessary comments 2015-04-10 19:33:59 -04:00
Deathamns 816dca2f33 Script injection, element picker, messaging
- Add script injection to vAPI, plus a raw implementation for Safari
  (element-picker.js requires it)
- Tweak element picker to work with Safari
- Revert a change from previous commit: element-picker.js' background
  message handler (since actually it can have its own messaging channel)
- Don't send "undefined" reponses from background to content
2015-04-10 19:33:59 -04:00
Deathamns 9981c25286 Remove storage change-event listener from Safari
Earlier, a technique was used to open the extension's Options page when
the user clicked a checkbox input at Safari's extension settings. The method was removed because:
- the Options page can be opened via the extension's toolbar button (which
  cannot be disabled in Safari, so it will be there all the time);
- involved more clicks than opening from the toolbar button;
- the string beside the checkbox couldn't be localized.
2015-04-10 19:33:58 -04:00
Deathamns be7668767f Minor changes
- Update assets from gorhill/uBlock/master
- Remove whitespace from element-picker.js
- Simplify code in profiler.js (btw, Date is still needed as fallback
  for older browsers)
- Clarification for Safari's storage where the QUOTA_BYTES came from
2015-04-10 19:33:58 -04:00
Deathamns 35ed9cd853 Work on vendor API abstraction, and near complete Safari support 2015-04-10 19:33:58 -04:00
gorhill 63aa4be9f7 reorganizing, preparing move to vAPI 2015-04-10 17:06:49 -04:00
gorhill 056e68da66 this fixes #42 2015-04-10 10:45:40 -04:00
gorhill 01f7cea94f re #89: fixed using non-compliant color 2015-01-12 22:40:52 -05:00
emanueLczirai 7085beb66a missing semicolon 2015-01-10 22:57:03 +01:00
gorhill 0174955287 comment re potential redundant eval 2014-12-24 08:29:55 -05:00
gorhill b68ba6d728 this fixes #82 2014-12-12 13:52:13 -05:00
Raymond Hill f0063372c5 this fixes #77 2014-12-07 17:46:19 -02:00
Raymond Hill 5777dc0b15 code review: actually no file: should occurs within https: doc 2014-12-05 10:45:43 -02:00
Raymond Hill baa8e86fd4 this addresses issue raised in #71 2014-12-05 10:43:47 -02:00
Raymond Hill b62fb94a00 code review 2014-11-30 21:41:27 -02:00
Raymond Hill 44533d77eb this fixes #72 2014-11-30 21:27:38 -02:00
Raymond Hill e39b36beda code review; make strict https break less stuff on new tab page 2014-11-29 09:50:24 -02:00
Raymond Hill 36233c7325 vertical ellispsis instead 2014-11-25 17:56:32 -02:00
Raymond Hill ee361ae37f comments 2014-11-22 10:26:37 -02:00
Raymond Hill a31351c6f9 doc is hardcoded now 2014-11-22 10:19:06 -02:00
Raymond Hill bf5b6c4517 code review 2014-11-22 09:36:45 -02:00
Raymond Hill 9a93c2375c move "Strict HTTPS" last since now it is built-in the browser 2014-11-22 01:41:22 -02:00
Raymond Hill cf02253cdd this should help futur occurrences of #65 2014-11-22 01:33:19 -02:00
Raymond Hill dc3de2a3ca make ua-spoofing code easier to read from dev tools 2014-11-21 08:54:48 -02:00
Raymond Hill 40bc8087e5 this fixes #61 2014-11-20 13:27:43 -02:00
Raymond Hill 238e6c3536 re #61 2014-11-20 11:40:52 -02:00
Raymond Hill 5d8bae3da2 this fixes #59 2014-11-19 23:17:24 -02:00
Raymond Hill 977f94a50a fine-tuning for RTL languages 2014-11-19 12:18:08 -02:00
Raymond Hill d01ab961b8 this fixes #7, #36 2014-11-19 11:59:38 -02:00
Raymond Hill ce6305210c UI work toward fixing #7, #36 2014-11-19 00:18:57 -02:00
Raymond Hill 5f3dc76b32 code review 2014-11-18 15:31:37 -02:00
Raymond Hill 5e19edaab7 ability to foil mixed content 2014-11-18 15:04:40 -02:00
Raymond Hill 5ba8f58094 ensure switches are listed first: more convenient 2014-11-18 13:37:12 -02:00
Raymond Hill 2962bd19e2 cide review 2014-11-18 08:57:57 -02:00
Raymond Hill 4aab150af3 infrastructure work toward addressing #7, #36 2014-11-18 00:18:04 -02:00
gorhill 3524c12924 fixed double definition as per 4bf6664d6b 2014-11-09 16:29:57 -05:00
gorhill f0a58ad06f bring back color hint for site-level scope 2014-11-09 12:17:44 -05:00
gorhill 3edd9eabc6 export must be on left side since permanent rules are exported 2014-11-07 18:29:13 -05:00
gorhill 4211613055 fix rendering of mu character 2014-11-07 14:36:20 -05:00
gorhill 970e1253da code review 2014-11-07 10:47:37 -05:00
gorhill 5d90401f54 this fixes #49 2014-11-07 09:05:05 -05:00
gorhill 9cc0e9bba0 this fixes #47 2014-11-06 12:12:04 -05:00
gorhill 667becf500 imported mutation observer code from uBlock: more efficient, robust 2014-11-06 10:15:41 -05:00
gorhill fb9def312a buttons must be able to wrap 2014-11-06 08:14:17 -05:00
Raymond Hill e8152f1517 ensure rule panes are always aligned 2014-11-05 21:59:04 -05:00
gorhill 8d8ff67546 just reordering labels 2014-11-05 18:54:08 -05:00
gorhill df6bdbe464 this fixes #44 completely 2014-11-05 18:52:21 -05:00
gorhill 4026149a17 this fixes #44 2014-11-05 18:11:57 -05:00
gorhill 4f456da482 translation work from Crowdin 2014-11-04 09:29:06 -05:00
gorhill 1d9a8e18e8 just trying something to possibly workaround reported crashes in #40 2014-11-04 08:49:30 -05:00
gorhill 92c48c0d49 "matrix:" instead of too generic "switch:" 2014-11-04 08:40:20 -05:00
gorhill 7e038a9433 use pretty 1st-party label only for rendering 2014-11-03 20:15:14 -05:00
gorhill 3ddb31a96c rtl languages friendly: issue #29 2014-11-03 14:27:59 -05:00
gorhill b42fd99bd0 no badge when count is zero 2014-11-02 18:43:12 -05:00
gorhill 1908504895 this fixes #37 completely 2014-11-02 18:34:03 -05:00
gorhill f6a366194c this address #37: the rebinding of pages which change incrementally 2014-11-02 18:19:48 -05:00
gorhill 2f7af6890d this addresses #37 2014-11-02 16:56:32 -05:00
gorhill e49e87ba54 better url 2014-11-02 14:17:52 -05:00
gorhill 50bcc24049 this is a start for #29 2014-11-02 12:10:21 -05:00
gorhill 3c455d3fdc give credits to issue authors 2014-11-02 09:42:05 -05:00
gorhill f7c2e68887 jshint 2014-11-02 00:36:55 -04:00
gorhill 4b4dc3c0db code review 2014-11-02 00:30:49 -04:00
Raymond Hill 4dd3b09ae4 this fixes #34 2014-11-01 22:46:14 -04:00
gorhill 85ecc71230 this fixes #31 2014-11-01 19:03:09 -04:00
gorhill 296f16f08e this fixes #31/#issuecomment-61376018 2014-11-01 14:44:39 -04:00
gorhill 8e7ae17b5c updating default UA strings 2014-11-01 14:22:11 -04:00
gorhill faef346878 this address 3 in #28 2014-11-01 12:52:02 -04:00
gorhill 575676e415 this addresses some of #28 issues 2014-11-01 12:22:44 -04:00
gorhill 48c5f7bf45 no longer needed 2014-10-31 18:52:57 -04:00
gorhill 30c570253f this fixes #23 2014-10-31 18:52:27 -04:00
gorhill 03609910c5 not needed anymore 2014-10-31 14:27:36 -04:00
gorhill 5c05a8773a revamped "My rules" tab 2014-10-31 14:14:41 -04:00
gorhill 89f757d61e this does help a bit further re. #27 2014-10-31 09:46:09 -04:00
gorhill 24502090e2 this somewhat fixes #27 2014-10-31 09:32:24 -04:00
gorhill 49bbe6f7dd ip address friendly 2014-10-30 10:30:26 -04:00
gorhill c5acad2332 minor code review 2014-10-29 10:10:30 -04:00
gorhill b2d19afeb8 finally... fixes #24 2014-10-29 10:10:07 -04:00
gorhill 9838d009aa this fixes #24 2014-10-29 09:59:02 -04:00
gorhill 967707723a this fixes #24 2014-10-29 09:27:11 -04:00
gorhill 49441de2b6 bring back doc req type; many little fixes 2014-10-28 23:21:06 -04:00
gorhill eab99cf26b forgot to rename to uMatrix (as per wilderssecurity.com thread) 2014-10-28 20:07:22 -04:00
gorhill 20ba3157eb slight colored bg for tooltips 2014-10-28 18:37:08 -04:00
gorhill 448a56cc70 fixed tooltips; illegal characters in messages.json 2014-10-28 18:34:44 -04:00
gorhill 10ef2cf0f1 fix meta row of blacklisted hostnames group 2014-10-28 14:33:16 -04:00
gorhill 425f512aa4 getting ready for crowdin work 2014-10-28 10:49:09 -04:00
gorhill ff4d827e1f this fixes #21 2014-10-28 00:38:02 -04:00
gorhill 02e6b2c2d8 oops: 5 min, not 5 hr 2014-10-28 00:18:51 -04:00
gorhill 257844c233 a bit of refacotring work 2014-10-28 00:14:15 -04:00
gorhill ead35cedbe code review 2014-10-27 16:19:46 -04:00
gorhill 5131a5d806 this fixes #19 2014-10-27 11:02:45 -04:00
gorhill 3aeeea7abd code review 2014-10-27 10:30:21 -04:00
gorhill 118306ab51 this fixes #17 2014-10-27 10:20:19 -04:00
gorhill e187161b84 take care of session storage as well 2014-10-26 19:41:22 -04:00
gorhill c0450c578d todo 2014-10-26 19:28:03 -04:00
gorhill 6d72b65a1a jshint 2014-10-26 19:27:24 -04:00
gorhill b605f3d4ea this fixes #18 2014-10-26 19:23:56 -04:00
gorhill 8cb0619687 fix to ensure PSL is available when binding tabs 2014-10-26 15:54:50 -04:00
gorhill abdbbd55dd jshint 2014-10-26 15:53:33 -04:00
gorhill 5e96f44798 this fixes #14 2014-10-26 15:51:04 -04:00
gorhill 77cfb56d94 this fixes #12 2014-10-26 13:36:27 -04:00
gorhill bd411290dd forgot to tag source code with github issue 2014-10-26 10:18:18 -04:00
gorhill b946a96bb6 this fixes #13, hopefully 2014-10-26 10:13:09 -04:00
gorhill ceed73dd59 this fixes another console error as per #10 2014-10-26 01:31:22 -04:00
gorhill cbb0b8a8f1 fixed as per code review 2014-10-25 23:46:53 -04:00
gorhill 8653401961 this fixes #10 2014-10-25 23:30:43 -04:00
gorhill 9441ffe719 this fixes #8 (the 2nd part) 2014-10-25 20:03:22 -04:00
gorhill b31b7227ff this fixes #8 2014-10-25 16:41:08 -04:00
gorhill fa84fa2508 this fixes #9 2014-10-25 16:36:45 -04:00
gorhill 92717f4cfd this fixes #4 2014-10-25 11:18:09 -04:00
gorhill 56a9e8a460 this fixes #3 2014-10-25 10:55:48 -04:00
gorhill 0d459545a2 this fixes #2 2014-10-24 23:21:26 -04:00
gorhill 0c6d0b3a98 another check for #1 2014-10-24 17:34:30 -04:00
gorhill 1743f198e5 another check for #1 2014-10-24 17:22:32 -04:00
gorhill 207ee2773b ui details 2014-10-24 14:57:05 -04:00
gorhill a39bd536b5 work on auto-update, backup/restore/reset 2014-10-24 11:13:46 -04:00
gorhill b94047f9f7 forgot to check this 2014-10-23 19:41:10 -04:00
gorhill 2b41bc8087 work on many things, need more 2014-10-23 19:40:48 -04:00
gorhill 65a8000657 fixed parsing of partial rules 2014-10-23 19:37:59 -04:00
gorhill dc39fa9452 moving assets out of src 2014-10-23 10:14:13 -04:00
gorhill 5f63a0f984 no good reason to prevent scopable literal "1st-party" 2014-10-23 07:47:53 -04:00
gorhill cd7996fb7d fixed bad test for 1st-party 2014-10-23 01:04:48 -04:00
gorhill 3952a09f6c dont display literal "1st-party" when there is no 1st-party 2014-10-22 21:26:37 -04:00
gorhill 78555a5b7c literal "1st-party" row removes the need for auto-whitelist, strict blocking 2014-10-22 19:46:30 -04:00
gorhill 85437661bf bring back behind-the-scene matrix 2014-10-22 10:25:57 -04:00
gorhill 1626c3ecc6 fix manually removing rules, code review 2014-10-22 10:02:19 -04:00
gorhill a633e16f01 user rules tab 2014-10-21 22:00:31 -04:00
gorhill e06985fcc7 dashboard tab to edit user rules 2014-10-21 19:12:25 -04:00
gorhill d944198a37 persistence: no more circumbombulated recipes, just plain line-by-line rules 2014-10-21 13:23:52 -04:00
gorhill d72e544e5a regression 2014-10-20 22:13:18 -04:00
gorhill ff0470dfa1 "1st-party" is domain, not hostname 2014-10-20 21:33:11 -04:00
gorhill a91c4fd27e issue #1: no more background page reference in popup 2014-10-20 21:19:24 -04:00
gorhill 35003b7e23 continued refactoring work: revert, revert all, persist are back 2014-10-20 16:40:09 -04:00
gorhill 186d10bf48 re issue #1 2014-10-20 00:53:13 -04:00
gorhill e3dcf085a8 remember last selected scope 2014-10-18 21:42:06 -04:00
gorhill 7e17e2ea84 code review 2014-10-18 17:11:10 -04:00
gorhill 804a5c53e0 no more jquery in popup 2014-10-18 16:49:06 -04:00
gorhill f676a745c3 move-away-from-jquery work 2014-10-18 01:09:09 -04:00
gorhill 7ac86a7138 argh, forgot to remove these before 1st commit 2014-10-17 15:40:37 -04:00
gorhill 0beb752db9 first commit 2014-10-17 15:01:09 -04:00