User:Asqueella/JEP 107: Difference between revisions

Jump to navigation Jump to search
(update for Myk's comments <http://groups.google.com/group/mozilla-labs-jetpack/msg/decd886a1ae37018>, except for "include" syntax)
Line 75: Line 75:
* [http://wiki.greasespot.net/Include_and_exclude_rules Greasemonkey scripts] specify include and exclude URLs, each may contain wildcards ("*") in any location and may use a special ".tld" domain. These rules get compiled to a regular expression (see [http://github.com/greasemonkey/greasemonkey/blob/master/content/convert2RegExp.js convert2RegExp]), which is then matched against every URL loaded in the browser.
* [http://wiki.greasespot.net/Include_and_exclude_rules Greasemonkey scripts] specify include and exclude URLs, each may contain wildcards ("*") in any location and may use a special ".tld" domain. These rules get compiled to a regular expression (see [http://github.com/greasemonkey/greasemonkey/blob/master/content/convert2RegExp.js convert2RegExp]), which is then matched against every URL loaded in the browser.
* [http://code.google.com/chrome/extensions/match_patterns.html Match patterns for Google Chrome's content scripts] are similar to Greasemonkey's, but force to specify domain (either fully, any domain, or <code>*.domain</code>) and don't have the magic tld domain.
* [http://code.google.com/chrome/extensions/match_patterns.html Match patterns for Google Chrome's content scripts] are similar to Greasemonkey's, but force to specify domain (either fully, any domain, or <code>*.domain</code>) and don't have the magic tld domain.
** Also of interest: [http://code.google.com/p/chromium/issues/detail?id=18259], [http://groups.google.com/a/chromium.org/group/chromium-extensions/browse_thread/thread/9e3903c0817b5837/3d305eb340f01763]
* When specifying CSS styling [https://developer.mozilla.org/en/Using_the_Stylesheet_Service Using the Stylesheet Service], which is an easy and robust way to apply CSS to all content and is also what Stylish uses, you have to describe the filters using CSS, i.e. [https://developer.mozilla.org/index.php?title=En/CSS/%40-moz-document @-moz-document] rule. It allows to specify domain, exact URL, or the URL prefix.
* When specifying CSS styling [https://developer.mozilla.org/en/Using_the_Stylesheet_Service Using the Stylesheet Service], which is an easy and robust way to apply CSS to all content and is also what Stylish uses, you have to describe the filters using CSS, i.e. [https://developer.mozilla.org/index.php?title=En/CSS/%40-moz-document @-moz-document] rule. It allows to specify domain, exact URL, or the URL prefix.


I claim the requirements for the include rules format are:
[http://groups.google.com/group/mozilla-labs-jetpack/msg/decd886a1ae37018 Myk's thoughts], "I need to take a closer look at this, but at first glance it looks like Chrome's format balances these goals best."
# Easy to use for the common case (unfortunately, no stats on which cases are common were collected, so we'll guess).
# An efficient implementation that determines which script mods to run on a page should be possible, since there may be many mods installed and each navigation requires us to determine which page mods apply to the page.
# If possible, the <code>include</code> rules for the script and style mods should use the same format.
 
A non-requirement is high level of control over which URLs are matched, since the highest level of control can be provided via a <code>filter</code> function, but it's important for performance to narrow down the set of URLs before running possibly expensive test determining whether to run the mod on a given page.
 
<nowiki>#3</nowiki> suggests we use a format that can be transformed to <code>@-moz-document</code> rules, i.e. a format that allows to specify the exact URL, the URL prefix, or the domain. This format also can be efficiently implemented (unlike e.g. a format that allows wildcards in the random positions of the URL).
 
This is how I've arrived at the format described above.


===== Other issues =====
===== Other issues =====
Confirmed users
161

edits

Navigation menu