Skip to content

Commit

Permalink
Download dependencies of scripts installed from the clipboard.
Browse files Browse the repository at this point in the history
Fixes #1699.
  • Loading branch information
Ventero authored and arantius committed Feb 1, 2013
1 parent 6b2d6a6 commit 14c638d
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions modules/util/installScriptFromSource.js
@@ -1,3 +1,4 @@
Components.utils.import('resource://greasemonkey/GM_notification.js');
Components.utils.import('resource://greasemonkey/parseScript.js');
Components.utils.import('resource://greasemonkey/remoteScript.js');
Components.utils.import('resource://greasemonkey/util.js');
Expand All @@ -12,9 +13,21 @@ function installScriptFromSource(aSource, aCallback) {
GM_util.writeToFile(aSource, tempFile, function() {
// install this script
remoteScript.setScript(script, tempFile);
remoteScript.install();
// and fire up the editor!
GM_util.openInEditor(script);
remoteScript.download(function(aSuccess){
if (!aSuccess) {
GM_notification(
'Could not download script\'s dependencies: '
+ remoteScript.errorMessage,
'dependency-download-failed');
return;
}

remoteScript.install();

// and fire up the editor!
GM_util.openInEditor(script);

if (aCallback) aCallback();
});
});
if (aCallback) aCallback();
}

0 comments on commit 14c638d

Please sign in to comment.