Permalink
Browse files

Merge commit '0.1.8' into staging

  • Loading branch information...
2 parents 410d9ab + 1289b2b commit 0d1e534c7ea783c638c971b91dcfe90b411c6e8a @erikvold erikvold committed Sep 23, 2012
Showing with 1,029 additions and 710 deletions.
  1. +24 −0 CONTRIBUTING.md
  2. +1 −2 README.md
  3. +1 −1 blocklist.json
  4. +4 −0 build.sh
  5. +8 −3 extension/chrome.manifest
  6. +7 −10 extension/components/scriptish.js
  7. +2 −2 extension/content/aboutScriptish.html
  8. +0 −67 extension/content/e10s/browser-content.js
  9. +0 −126 extension/content/e10s/browser.js
  10. +0 −20 extension/content/e10s/browser.xul
  11. +0 −8 extension/content/fennec-options.xul
  12. +3 −0 extension/content/js/browser.js
  13. +4 −2 extension/content/js/newscript.js
  14. +71 −0 extension/content/js/options.js
  15. +14 −16 extension/content/js/updatecheck.js
  16. +15 −0 extension/content/options.xul
  17. +28 −0 extension/content/tests/testPatternCollection.js
  18. +6 −12 extension/content/tests/testScriptishLogger.js
  19. +2 −0 extension/defaults/preferences/scriptish.js
  20. +6 −10 extension/install.rdf
  21. +1 −1 extension/locale/de/description.properties
  22. +6 −0 extension/locale/de/scriptish.properties
  23. +1 −1 extension/locale/en-US/description.properties
  24. +6 −0 extension/locale/en-US/scriptish.properties
  25. +4 −4 extension/locale/es-ES/description.properties
  26. +17 −11 extension/locale/es-ES/scriptish.properties
  27. +13 −0 extension/locale/he/description.properties
  28. +169 −0 extension/locale/he/scriptish.properties
  29. +13 −0 extension/locale/hu/description.properties
  30. +169 −0 extension/locale/hu/scriptish.properties
  31. +1 −1 extension/locale/ja-JP/description.properties
  32. +8 −2 extension/locale/ja-JP/scriptish.properties
  33. +1 −1 extension/locale/pl/description.properties
  34. +6 −0 extension/locale/pl/scriptish.properties
  35. +1 −1 extension/locale/pt-BR/description.properties
  36. +6 −0 extension/locale/pt-BR/scriptish.properties
  37. +13 −13 extension/locale/ru-RU/description.properties
  38. +133 −127 extension/locale/ru-RU/scriptish.properties
  39. +2 −2 extension/locale/sv-SE/description.properties
  40. +21 −15 extension/locale/sv-SE/scriptish.properties
  41. +1 −1 extension/locale/zh-CN/description.properties
  42. +6 −0 extension/locale/zh-CN/scriptish.properties
  43. +1 −1 extension/locale/zh-TW/description.properties
  44. +6 −0 extension/locale/zh-TW/scriptish.properties
  45. +0 −21 extension/modules/addonprovider.js
  46. +40 −57 extension/modules/api.js
  47. +1 −0 extension/modules/api/GM_Resources.js
  48. +4 −2 extension/modules/api/GM_console.js
  49. +24 −4 extension/modules/api/GM_xmlhttpRequester.js
  50. +35 −28 extension/modules/constants.js
  51. +1 −1 extension/modules/logging.js
  52. +1 −5 extension/modules/manager.js
  53. +12 −0 extension/modules/menucommander.js
  54. +19 −2 extension/modules/prefmanager.js
  55. +1 −6 extension/modules/script/script.js
  56. +7 −17 extension/modules/script/scriptdownloader.js
  57. +41 −44 extension/modules/third-party/regexpmerger.js
  58. +23 −15 extension/modules/utils/Scriptish_injectScripts.js
  59. +0 −6 extension/modules/utils/Scriptish_notification.js
  60. +0 −5 extension/modules/utils/Scriptish_openInTab.js
  61. +0 −11 extension/modules/utils/Scriptish_sendAsyncE10SMessage.js
  62. +1 −1 extension/modules/utils/Scriptish_stringBundle.js
  63. +10 −11 extension/modules/utils/Scriptish_windowUnloader.js
  64. +3 −0 extension/skin/options.css
  65. +5 −14 update.rdf
View
@@ -0,0 +1,24 @@
+# Contributing
+
+## Overview
+
+* Code contributions should follow the [style guide](https://github.com/scriptish/scriptish/wiki/JavaScript-Style-Guide).
+* Tests may be requested, and eventually will be required.
+* All code must be reviewed by a reviewer.
+** Sometimes code will need additional reviews.
+
+## Contributing Code
+
+* Check that your [issue](https://github.com/scriptish/scriptish/issues) does not
+already exist.
+* If it does not yet exist [please create one](https://github.com/scriptish/scriptish/issues/new).
+* Make your changes, preferably in a branch named `bug_number`.
+* Make sure there is a test in the branch (reverse the order of this for TDD).
+* Mention your `branch_name`, with a link to it, in the issue thread.
+* Ask for a review from one our reviewers.
+
+## Reviewers
+
+* [@erikvold](https://github.com/erikvold)
+* [@supahgreg](https://github.com/supahgreg)
+* [@nmaier](https://github.com/nmaier)
View
@@ -6,7 +6,6 @@ Scriptish is a userscript manager for Firefox, forked from Greasemonkey.
# Browsers Supported
* Firefox 4+
-* Fennec 4+
* Seamonkey 2.1+
@@ -17,6 +16,6 @@ Scriptish is a userscript manager for Firefox, forked from Greasemonkey.
* [Addons.Mozilla.Org (AMO)](https://addons.mozilla.org/firefox/addon/scriptish)
* [Userscripts](http://userscripts.org)
* [Wiki](https://github.com/scriptish/scriptish/wiki)
-* [Issues](http://scriptish.lighthouseapp.com/projects/83146-firefox-extension/)
+* [Issues](https://github.com/scriptish/scriptish/issues)
* [Google Group](http://groups.google.com/group/scriptish)
* [Source Code](https://github.com/scriptish/scriptish)
View
@@ -1,3 +1,3 @@
{
- "uso": [20145, 26062, 35611, 38017, 68219]
+ "uso": [20145, 26062, 35611, 38017, 59744, 68219, 92054, 114457, 128437, 130770]
}
View
@@ -56,3 +56,7 @@ if [ "test" != "$1" ]; then
fi
cd ..
rm -rf build
+
+if [ "amo" == "$1" ] || [ "staging" == "$1" ]; then
+ openssl sha1 "$XPI"
+fi
View
@@ -1,20 +1,24 @@
+# TODO: remove/replace/improve
component {ca39e060-88ab-11df-a4ee-0800200c9a66} components/scriptish.js
contract @scriptish.erikvold.com/scriptish-service;1 {ca39e060-88ab-11df-a4ee-0800200c9a66}
category content-policy @scriptish.erikvold.com/scriptish-service;1 @scriptish.erikvold.com/scriptish-service;1
+# TODO: add this dynamically
component {5f28a810-8094-11e0-b278-0800200c9a66} components/aboutScriptish.js
contract @mozilla.org/network/protocol/about;1?what=scriptish {5f28a810-8094-11e0-b278-0800200c9a66}
+# TODO: REMOVE
content scriptish content/
+# TODO: register dynamically
resource scriptish modules/
skin scriptish classic/1.0 skin/
+
style chrome://global/content/customizeToolbar.xul chrome://scriptish/skin/browser.css
style chrome://global/content/customizeToolbar.xul chrome://scriptish/content/third-party/firebug/startButton.css
style chrome://global/content/alerts/alert.xul chrome://scriptish/skin/third-party/alert.css os=Darwin
overlay chrome://browser/content/browser.xul chrome://scriptish/content/browser.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
overlay chrome://browser/content/browser.xul chrome://scriptish/content/browser.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
-overlay chrome://browser/content/browser.xul chrome://scriptish/content/e10s/browser.xul application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
overlay chrome://browser/content/scratchpad.xul chrome://scriptish/content/scratchpad.xul
overlay chrome://navigator/content/navigator.xul chrome://scriptish/content/browser.xul
overlay about:addons chrome://scriptish/content/addonstab.xul
@@ -26,11 +30,12 @@ overlay chrome://scriptish/content/install.xul chrome://scriptish/content/clo
overlay chrome://scriptish/content/options.xul chrome://scriptish/content/closewindow.xul
overlay chrome://scriptish/content/newscript.xul chrome://scriptish/content/closewindow.xul
-override chrome://scriptish/content/options.xul chrome://scriptish/content/fennec-options.xul application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
-
+# TODO: remove below, do dynamically.
locale scriptish en-US locale/en-US/
locale scriptish de locale/de/
locale scriptish es-ES locale/es-ES/
+locale scriptish he locale/he/
+locale scriptish hu locale/hu/
locale scriptish ja-JP locale/ja-JP/
locale scriptish pl locale/pl/
locale scriptish pt-BR locale/pt-BR/
@@ -1,3 +1,4 @@
+"use strict";
const DESCRIPTION = "ScriptishService";
const CONTRACTID = "@scriptish.erikvold.com/scriptish-service;1";
const CLASSID = Components.ID("{ca39e060-88ab-11df-a4ee-0800200c9a66}");
@@ -32,15 +33,11 @@ const RE_USERSCRIPT = /\.user(?:-\d+)?\.js$/;
const RE_CONTENTTYPE = /text\/html/i;
function ScriptishService() {
- if ("Fennec" != Services.appinfo.name) {
- Scriptish_manager.setup.call(this);
- Services.obs.addObserver(this, "install-userscript", false);
- Services.obs.addObserver(this, "scriptish-enabled", false);
- Services.obs.addObserver(this, "content-document-global-created", false);
- Services.obs.addObserver(this, "chrome-document-global-created", false);
- } else {
- //Services.mm.
- }
+ Scriptish_manager.setup.call(this);
+ Services.obs.addObserver(this, "install-userscript", false);
+ Services.obs.addObserver(this, "scriptish-enabled", false);
+ Services.obs.addObserver(this, "content-document-global-created", false);
+ Services.obs.addObserver(this, "chrome-document-global-created", false);
}
ScriptishService.prototype = {
@@ -190,7 +187,7 @@ ScriptishService.prototype = {
"chrome": true,
"resource": true
},
- _reg_userjs: /\.user\.js$/,
+ _reg_userjs: /^[^#\?=]+\.user\.js$/,
shouldLoad: function(ct, cl, org, ctx, mt, ext) {
// block content detection of scriptish by denying it chrome: & resource:
// content, unless loaded from chrome: or about:
@@ -45,8 +45,8 @@
</header>
<p>There are many ways you can help out with Scriptish:</p>
<ul>
- <li><a href="http://scriptish.lighthouseapp.com/projects/83146/tickets/new">Report a bug</a></li>
- <li><a href="http://scriptish.lighthouseapp.com/projects/83146/tickets/new">Request a feature</a></li>
+ <li><a href="https://github.com/scriptish/scriptish/issues/new">Report a bug</a></li>
+ <li><a href="https://github.com/scriptish/scriptish/issues/new">Request a feature</a></li>
<li>Like coding? <a href="https://github.com/scriptish/scriptish">Collaborate!</a></li>
</ul>
</section>
@@ -1,67 +0,0 @@
-(function(inc, tools, global){
-inc("resource://scriptish/constants.js", tools);
-const {lazyImport, lazyUtil} = tools;
-lazyImport(global, "resource://scriptish/logging.js", ["Scriptish_log"]);
-lazyImport(global, "resource://scriptish/manager.js", ["Scriptish_manager"]);
-lazyImport(global, "resource://scriptish/script/simple-script.js", ["SimpleScript"]);
-lazyImport(global, "resource://scriptish/utils/Scriptish_isURLExcluded.js", [
- "Scriptish_setExcludes"
-]);
-
-global.Scriptish_installUri = function(aURL) {
- sendAsyncMessage("Scriptish:InstallScriptURL", aURL);
-}
-
-function updateExcludes({json}) {
- Scriptish_setExcludes(json);
-}
-
-var configJSON = sendSyncMessage("Scriptish:FrameSetup", "")[0];
-var scripts;
-
-(function(configJSON) {
- Scriptish_setExcludes(configJSON.excludes);
-
- scripts = configJSON.scripts.map(function(i) {
- return SimpleScript.loadFromJSON(i);
- });
-
- Scriptish_manager.setup({
- global: global,
- content: content,
- scripts: scripts
- });
-})(configJSON);
-
-addMessageListener("Scriptish:GlobalExcludesUpdate", updateExcludes);
-addMessageListener("Scriptish:ScriptInstalled", function({json}) {
- scripts.push(SimpleScript.loadFromJSON(json));
-});
-addMessageListener("Scriptish:ScriptChanged", function({json}) {
- var script = SimpleScript.loadFromJSON(json);
- for (var i = scripts.length - 1; ~i; i--) {
- if (scripts[i].id == script.id) {
- scripts[i] = script;
- return;
- }
- }
-});
-addMessageListener("Scriptish:ScriptUninstalled", function({json}) {
- for (var i = scripts.length - 1; ~i; i--) {
- if (scripts[i].id == json) {
- scripts.splice(i, 1);
- return;
- }
- }
-});
-})(Components.utils.import, {}, this);
-
-
-addEventListener("load", function() {
- ContextHandler.registerType("userscript-install", function(popupState, element) {
- if (/\.user\.js$/.test(element.href)) {
- return true;
- }
- return false;
- });
-}, true);
@@ -1,126 +0,0 @@
-
-(function(inc, tools, global){
- inc("resource://scriptish/constants.js", tools);
- const {lazyImport, lazyUtil, Services} = tools;
- lazyImport(global, "resource://scriptish/logging.js", ["Scriptish_log"]);
- lazyImport(global, "resource://scriptish/manager.js", ["Scriptish_manager"]);
- lazyImport(global, "resource://scriptish/config.js", ["Scriptish_config"]);
- lazyImport(global, "resource://scriptish/api/GM_Resources.js", ["GM_Resources"]);
- lazyImport(global, "resource://scriptish/api/GM_ScriptStorage.js", ["GM_ScriptStorage"]);
-
- lazyUtil(global, "installUri");
- lazyUtil(global, "getScriptHeader");
- lazyUtil(global, "notification");
- lazyUtil(global, "openInTab");
-
- var $ = function(id) document.getElementById(id);
-
- addEventListener("load", function() {
- // Check if Scriptish has been updated/installed
- inc("resource://scriptish/utils/Scriptish_updateChk.js");
-
- var us_head = $("addons-userscripts");
- var parent = us_head.parentNode;
-
- function createNode(script) {
- var ele = ExtensionsView._createItem(script, "userscript");
- ele.setAttribute("typeLabel", "User Script");
- // TODO: implement for Fennec.. #517
- //ele.setAttribute("optionsURL", script.optionsURL);
- ele.setAttribute("isDisabled", !script.enabled);
- ele.setAttribute("data-scriptish-scriptid", script.id);
- ele.addon = script;
- return ele;
- }
-
- function insertScript(script) {
- parent.insertBefore(createNode(script), us_head.nextSibling);
- }
-
- // insert script nodes into the EM
- Scriptish_config.scripts.forEach(insertScript);
- Services.obs.addObserver({
- observe: function(aSubject, aTopic, aData) {
- tools.timeout(function() {
- var script = Scriptish_config.getScriptById(JSON.parse(aData).id);
- insertScript(script);
- });
- }
- }, "scriptish-script-installed", false);
-
- // replace script nodes when there is a change to script
- var updateObs = {
- observe: function(aSubject, aTopic, aData) {
- tools.timeout(function() {
- var script = Scriptish_config.getScriptById(JSON.parse(aData).id);
- var node = createNode(script);
- var id = node.getAttribute("id");
- var oldNode = $(id);
- if (oldNode) parent.replaceChild(node, oldNode);
- else insertScript(script); // jic
- });
- }
- };
- Services.obs.addObserver(updateObs, "scriptish-script-modified", false);
- Services.obs.addObserver(updateObs, "scriptish-script-updated", false);
- }, false);
-
- var mm = messageManager;
-
- mm.addMessageListener("Scriptish:InstallScriptURL", function({json}) {
- return Scriptish_installUri(json);
- });
-
- mm.addMessageListener("Scriptish:FrameSetup", function() {
- return Scriptish_config.toJSON();
- });
-
- mm.addMessageListener("Scriptish:GetScriptContents", function({json}) {
- return Scriptish_config.getScriptById(json).textContent;
- });
-
- mm.addMessageListener("Scriptish:GetScriptResourceURL", function({json}) {
- return new GM_Resources(Scriptish_config.getScriptById(json.scriptID)).getResourceURL(json.resource);
- });
-
- mm.addMessageListener("Scriptish:GetScriptResourceText", function({json}) {
- return new GM_Resources(Scriptish_config.getScriptById(json.scriptID)).getResourceText(json.resource);
- });
-
- mm.addMessageListener("Scriptish:GetScriptRequires", function({json}) {
- var script = Scriptish_config.getScriptById(json);
- if (!script) return [];
-
- var rtnAry = [];
- script.requires.forEach(function(req) {
- rtnAry.push({
- fileURL: req.fileURL,
- textContent: req.textContent
- });
- });
- return rtnAry;
- });
-
- mm.addMessageListener("Scriptish:ScriptNotification", function({json}) {
- Scriptish_notification.apply(null, json);
- });
-
- mm.addMessageListener("Scriptish:ScriptSetValue", function({json}) {
- var script = Scriptish_config.getScriptById(json.scriptID);
- var storage = new GM_ScriptStorage(script);
- return storage.setValue.apply(storage, json.args);
- });
-
- mm.addMessageListener("Scriptish:GetScriptMetadata", function({json}) {
- return Scriptish_getScriptHeader(Scriptish_config.getScriptById(json.id), json.key, json.localVal);
- });
-
- mm.addMessageListener("Scriptish:OpenInTab", function({json}) {
- json.push(global);
- return Scriptish_openInTab.apply(null, json);
- });
-
- mm.loadFrameScript(
- "chrome://scriptish/content/e10s/browser-content.js",
- true); // no delay loading frame script
-})(Components.utils.import, {}, this);
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-stylesheet href="chrome://scriptish/skin/browser-fennec.css" type="text/css"?>
-<overlay id="scriptish-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script type="application/javascript" src="chrome://scriptish/content/e10s/browser.js"/>
-
- <richlistbox id="context-commands">
- <richlistitem id="scriptish-userscript-install-context-command"
- class="context-command"
- type="userscript-install"
- onclick="Scriptish_installUri(ContextHelper.popupState.linkURL);">
- <label value="Install User Script"/>
- </richlistitem>
- </richlistbox>
-
- <richlistbox id="addons-list">
- <richlistitem id="addons-userscripts" insertbefore="addons-local" class="section-header" align="center">
- <label value="Your User Scripts" flex="1"/>
- </richlistitem>
- </richlistbox>
-</overlay>
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <setting pref="extensions.scriptish.enabled" type="bool" title="Scripts Enabled"/>
- <setting pref="extensions.scriptish.cache.enabled" type="bool" title="Cache Enabled"/>
- <setting pref="extensions.scriptish.uninstallPreferences" type="bool" title="Remove Script Preferences">
- Remove preferences associated with a user script when the script is uninstalled.
- </setting>
-</vbox>
@@ -254,6 +254,9 @@ Scriptish_BrowserUI.reattachMenuCmds = function() {
*/
Scriptish_BrowserUI.chromeUnload = function() {
gBrowser.removeProgressListener(this);
+ // kill reference to this document
+ this.menuCommanders.forEach(function({commander}) commander.destroy());
+ // kill reference to menuCommanders
delete this.menuCommanders;
}
@@ -87,8 +87,10 @@ function doInstall() {
// put this created script into a file -- only way to install it
var tempFile = Scriptish_getTempFile();
var foStream = Scriptish_getWriteStream(tempFile);
- foStream.write(script, script.length);
- foStream.close();
+ var converter = Instances.cos;
+ converter.init(foStream, "UTF-8", 0, 0);
+ converter.writeString(script);
+ converter.close(); // this closes foStream
// create a script object with parsed metadata,
script = Scriptish_config.parse(script);
Oops, something went wrong.

0 comments on commit 0d1e534

Please sign in to comment.