{"issue":{"milestone":null,"user":{"id":45797,"login":"john-sanders-2","url":"https://api.github.com/users/john-sanders-2","avatar_url":"https://secure.gravatar.com/avatar/de3a2504d39df7ed5137e0cc3dee95c1?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"de3a2504d39df7ed5137e0cc3dee95c1"},"created_at":"2011-11-10T20:18:23Z","title":"Adding an @require breaks Greasemonkey","state":"open","updated_at":"2011-12-18T19:04:06Z","labels":[{"name":"worksforme","url":"https://api.github.com/repos/greasemonkey/greasemonkey/labels/worksforme","color":"f29513"}],"id":2202218,"html_url":"https://github.com/greasemonkey/greasemonkey/issues/1466","closed_at":null,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"I'm using Firefox 8.0, Greasemonkey 0.9.12, on Windows 7 (all latest updates).\r\n\r\nI've been using a hand rolled Greasemonkey script to update parts of an Intranet page I use all the time.  I changed the require tag to use the latest jQuery and the script stopped executing.\r\n\r\nAfter a lot of testing, I've broken the problem down to the smallest parts possible to see if I was doing something wrong.  I have:\r\n\r\n1. Created a new profile.\r\n2. Installed Greasemonkey, and created a new script for the page.\r\n3. The only code added was: alert('working');\r\n4. Verified the script worked, and it does.\r\n5. Edited the script again (GM icon->manage scripts->edit), and added a require tag to bring in jQuery 1.7 (although any version I've tried causes the same problem).  The script fails to run.\r\n\r\nMy entire script reads as follows (domain name changed):\r\n\r\n```javascript\r\n// ==UserScript==\r\n// @name           Helper Scripts\r\n// @namespace      w\r\n// @include        http://example.com/*\r\n// @require        http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js\r\n// ==/UserScript==\r\n\r\nalert('working');\r\n```\r\n\r\nThe script stops working.  Does not kick any errors or warnings in the Javascript console.  I did notice the config.xml does get updated, but not correctly (i presume).  Here's the result of the config.xml after I load the test page:\r\n\r\n```xml\r\n<UserScriptConfig>\r\n\t<Script filename=\"helper_scripts.user.js\" name=\"Helper Scripts\" namespace=\"w\" description=\"\" version=\"\" enabled=\"true\" runAt=\"document-end\" basedir=\"helper_scripts\" modified=\"1320954850701\" dependhash=\"30ee872c576e6e700ef9c9ad7e01f8605a750f52\" updateAvailable=\"\" lastUpdateCheck=\"\">\r\n\t\t<Include>http://example.com/*</Include>\r\n\t\t<Require filename=\"\"/>\r\n\t</Script>\r\n</UserScriptConfig>\r\n```\r\n\r\nI'm assuming that the GM adding the tag with the empty filename attribute is messing things up.  If you edit the XML directly, and reload, GM will wipe it out and revert it back to an empty attribute again.\r\n\r\nI'm perplexed, and would love to have my GM scripts back.  Any help would be appreciated.\r\n\r\nJohn Sanders","number":1466,"url":"https://api.github.com/repos/greasemonkey/greasemonkey/issues/1466","comments":3,"assignee":null},"comment":{"user":{"id":286287,"login":"zewt","url":"https://api.github.com/users/zewt","avatar_url":"https://secure.gravatar.com/avatar/e92146e270ae11efac6405927b6439af?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"e92146e270ae11efac6405927b6439af"},"created_at":"2011-12-18T19:04:06Z","updated_at":"2011-12-18T19:04:06Z","id":3196237,"body":"This is happening to me, too, triggering:\r\n\r\nError: uncaught exception: [Exception... \"Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIFile.remove]\"  nsresult: \"0x80004005 (NS_ERROR_FAILURE)\"  location: \"JS frame :: chrome://greasemonkey/content/script.js :: <TOP_LEVEL> :: line 507\"  data: no]\r\n\r\nThis is the remove() call in:\r\n\r\n    // Get rid of old dependencies.\r\n    var dirFiles = this._basedirFile.directoryEntries;\r\n    while (dirFiles.hasMoreElements()) {\r\n      var nextFile = dirFiles.getNext()\r\n          .QueryInterface(Components.interfaces.nsIFile);\r\n      if (!nextFile.equals(this.file)) nextFile.remove(true);\r\n    }\r\n\r\nThat tries to remove Vim's .swp file, which fails since the file is open and locked.  This should be more selective about what it deletes, and not fail entirely if removing a single file fails.\r\n\r\nA more usable workaround is to close Vim (or whatever you're using that's creating a lockfile) after changing dependencies, and reload the page to cause dependencies to be updated while your editor is closed.\r\n","url":"https://api.github.com/repos/greasemonkey/greasemonkey/issues/comments/3196237"},"action":"created"}