Index: docs/dealing_with_greasemonkey.md |
diff --git a/docs/dealing_with_greasemonkey.md b/docs/dealing_with_greasemonkey.md |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3c82d328d4e0358fe4d0dd2eb949903dd6c4ec02 |
--- /dev/null |
+++ b/docs/dealing_with_greasemonkey.md |
@@ -0,0 +1,38 @@ |
+# Introduction |
+ |
+Lots of users still complain that Chrome does not support Greasemonkey user scripts. Even though we have had the infrastructure in place to handle user scripts for some time now, it has never been clear how the feature would relate to full extensions, and so it has remained incomplete. |
Bons
2015/08/20 20:16:50
propose to delete due to the age of the doc
|
+ |
+http://crbug.com/16344 was the previous proposal for rationalizing these two features, but many team members disliked it due to the result of maintaining two parallel systems. |
+ |
+This new proposal is on how we can transparently convert existing .user.js files into extensions. This would make Greasemonkey user script support a first-class feature in Chrome. |
+ |
+ |
+# Details |
+ |
+Our goal is to be able to click on a .user.js file on the web, get a Chrome extension install experience, and from that point on have a normal, fully-functioning Chrome extension. |
+ |
+A Greasemonkey user script includes: |
+ |
+ 1. A unique name (using XML-style namespaces) |
+ 1. A single script file |
+ 1. Some include and exclude rules that control where it runs |
+ 1. References to some Greasemonkey-specific APIs |
+ |
+A Chrome extension with similar functionality to a Greasemonkey script includes: |
+ |
+ 1. A randomly-generated unique public key |
+ 1. A unique ID which is a fingerprint of its public key |
+ 1. Some match patterns that control where it runs (mostly compatible with Greasemonkey syntax but different in details) |
+ 1. One or more physical JS files |
+ |
+It should be possible for Chrome to transparently convert a Greasemonkey script into an extension like so: |
+ |
+ 1. Hash the user script's unique name into a public key. |
+ * It is important to hash the name instead of generating a random public key so that if a user script is overinstalled, Chrome will detect it as an overinstall. |
+ * There will be no corresponding private key, but that is OK since user scripts do not update. |
+ 1. Convert Greasemonkey include rules into Chrome extension match patterns. In cases where this isn't possible, use a match pattern that matches everything and evaluate the Greasemonkey rule in JavaScript. |
+ 1. Include a small Greasemonkey emulation layer for the Greasemonkey-specific APIs (we already have this implemented). |
+ |
+With all this in place, we could remove the support for the existing --enable-user-scripts feature, which would simplify lots of our code. |
+ |
+We could also in the future add a developer tool to start a new Chrome extension based on an existing Greasemonkey user script. |