Skip to content

Commit

Permalink
Set the delayInjection flag before scriptDownloader is run so that it…
Browse files Browse the repository at this point in the history
… can turn it off. This gets rid of the bug where you remove dependencies, and the delayInjection flag remains perpetually on. Closes greasemonkey#1165
  • Loading branch information
sizzlemctwizzle committed Jul 13, 2010
1 parent 7a4b0d2 commit 8c6183f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions content/config.js
Expand Up @@ -345,13 +345,13 @@ Config.prototype = {
},

updateModifiedScripts: function(safeWin, chromeWin) {
// Find any updated scripts
// Find any updated scripts or scripts with delayed injection
var scripts = this.getMatchingScripts(
function (script) { return script.isModified(); });
function (script) { return script.delayInjection || script.isModified(); });
if (0 == scripts.length) return;

for (var i = 0, script; script = scripts[i]; i++) {
if (!script.pendingExec) {
if (!script.delayInjection) {
var parsedScript = this.parse(
script.textContent, script._downloadURL, true);
script.updateFromNewScript(parsedScript, safeWin, chromeWin);
Expand Down
5 changes: 3 additions & 2 deletions content/script.js
Expand Up @@ -318,13 +318,14 @@ Script.prototype = {
this.pendingExec = [];
this.pendingExec.push({'safeWin': safeWin, 'chromeWin': chromeWin});

// This flag needs to be set now so the scriptDownloader can turn it off
this.delayInjection = true;

// Redownload dependencies.
var scriptDownloader = new GM_ScriptDownloader(null, null, null);
scriptDownloader.script = this;
scriptDownloader.updateScript = true;
scriptDownloader.fetchDependencies();

this.delayInjection = true;
}
},

Expand Down

0 comments on commit 8c6183f

Please sign in to comment.