adobe-research / theseus

A pretty darn cool JavaScript debugger for Brackets
Other
1.34k stars 69 forks source link

Errors installing Theseus on Brackets (sprint 38) #58

Closed yelper closed 10 years ago

yelper commented 10 years ago

Hi there,

I'm having issues installing Theseus for Brackets through the UI. I'm using Brackets (sprint 38 experimental build 0.38.0-12606 (release 4df8afdad)). The installation prompts a generic error in the Brackets UI, and shows in the extension list as having an 'extension error'.

The Brackets developer log has the following after downloading Theseus and trying to install. I'm new to both projects so I might be missing something simple, but the extra .js extensions seem suspect. The files (sans the .js extensions for the HTML pages) seem to be in the Theseus folder inside the extensions folder.

GET file://[windowsfileserver]/users$/[username]/AppData/Roaming/Brackets/extensions/user/theseus/package.json.js  require.js:1872
GET file://[windowsfileserver]/users$/[username]/AppData/Roaming/Brackets/extensions/user/theseus/src/InstallationCorrupt.html.js  require.js:1872
Uncaught Error: Script error for: package.json
http://requirejs.org/docs/errors.html#scripterror require.js:163
Uncaught Error: Script error for: src/InstallationCorrupt.html
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file://[windowsfileserver]/users$/[username]/AppData/Roaming/Brackets/extensions/user/theseus/src/Invitation.html.js  require.js:1872
Uncaught Error: Script error for: src/Invitation.html
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file://[windowsfileserver]/users$/[username]/AppData/Roaming/Brackets/extensions/user/theseus/src/NewVersionAvailable.html.js  require.js:1872
GET file://[windowsfileserver]/users$/[username]/AppData/Roaming/Brackets/extensions/user/theseus/src/InvalidVersion.html.js  require.js:1872
Uncaught Error: Script error for: src/NewVersionAvailable.html
http://requirejs.org/docs/errors.html#scripterror require.js:163
Uncaught Error: Script error for: src/InvalidVersion.html
http://requirejs.org/docs/errors.html#scripterror require.js:163
[theseus] fsm: -> waitingForApp fsm.js:35
[theseus] fsm: -> disconnected fsm.js:35
[Extension] failed to load //[windowsfileserver]/users$/[username]/AppData/Roaming/Brackets/extensions/user/theseus Error: Load timeout for modules: text!package.json_unnormalized2,text!src/InstallationCorrupt.html_unnormalized3,text!package.json,text!src/InstallationCorrupt.html,text!src/Invitation.html,text!src/NewVersionAvailable.html,text!src/InvalidVersion.html
http://requirejs.org/docs/errors.html#timeout /utils/ExtensionLoader.js:209
Uncaught RangeError: Maximum call stack size exceeded
alltom commented 10 years ago

They do seem suspect!

Unfortunately, I can't reproduce this with the same version of Brackets on OS X. I'll see if I can't find a computer with Windows.

alltom commented 10 years ago

@peterflynn and I tried on Windows and neither of us got an error. I tried on Windows 7. Which version of Windows are you using?

What kind of generic error do you see?

Are you installing from the Extension Manager? A ZIP file downloaded from the extension registry? GitHub? (It won't work from GitHub, but the other two should work.)

Have you installed Brackets from source? If so, perhaps your submodules are way out of date? (It might be that an old requirejs is misinterpreting the "text!" prefix for HTML files.)

yelper commented 10 years ago

Thank you both for taking a look at this!

With Brackets from the Sprint 38 .msi, I am installing Theseus from the package manager, which brings up the modal dialog while it downloads the extension: theseus-install

I see this generic error after installing in the lab: theseus-error

I was able to successfully install Theseus at home; maybe in the lab the user profile (%APPDATA%) being on a Windows File Share instead of locally causes a problem?.. but that would be strange since the files seem to be copied over okay (%APPDATA%/Brackets/extensions/user/theseus/). Do I need administrative permissions in order to install extensions?

alltom commented 10 years ago

How proficient are you at debugging JavaScript? Would you be able to:

(assuming those aren't the same thing; maybe they are)

If not, I'll ping brackets-dev and see if anyone else has the means to reproduce your setup.

peterflynn commented 10 years ago

@yelper You might also try disabling all your other extensions to see if any of them are causing a problem.

It sure does sound like something is wrong with the RequireJS "text" plugin -- it basically appears to be getting ignored. Why that would be (and how it could happen without breaking the stuff in core that depends on it) is a mystery, though...

yelper commented 10 years ago

I'm not running any other extensions, unfortunately.

It seems to be a bug in RequireJS; in require.js (line 1612):

url += (ext || (/\?/.test(url) || skipExt ? '' : '.js'));

where it tries to convert a named resource to a URL, and a .js suffix is added to those files loaded as text (e.g. text!...). I couldn't immediately tell why this happens however (or what the correct behavor is). I tried adding dummy query strings to the places where text resources are loaded, to force the second condition above to be true (e.g. Invitation.js, line 34 with added ?junk):

var dialogHTML     = require("text!./Invitation.html?junk");

... but it didn't seem to help.

peterflynn commented 10 years ago

@yelper I don't think it should even be getting into nameToUrl() though -- the code in makeModuleMap() should be getting into the if (prefix) { case. Can you debug in makeModuleMap() and trace through the beginning part where splitPrefix() is called and prefix is calculated? Is the text! prefix not being seen?

yelper commented 10 years ago

I'm getting a little out of my element here, but I think I found the source of the error.

Since the resources are being loaded from a different server (user profile directory is on external server), the second fork of text.js (in load(), line 194) is taken, which subsequently calls req() with the stripped name (line 199, [nonStripName]), eventually calling makeModuleMap() with no prefix, so nameToUrl() is called that adds .js to the end of the resource names (below).

I'm not immediately clear what the next steps or how to solve this bug are. It doesn't seem to be an issue with this project anymore. :) Who owns text.js?

The fetching of the following files (all called originally with text! prefixes) fail because of this bug.

Thanks for bearing through this! I appreciate it.

peterflynn commented 10 years ago

@yelper What values are you seeing to the arguments of useXhr() on that line? I would assume even if your user profile is mapped onto a network storage location, it will appear as part of the local filesystem -- so it would still be seen as a file: protocol by CEF when loading it.

yelper commented 10 years ago

There's probably a problem with the regular expression doing the matching (not being Windows-aware). However, both protocol and hostname have mis-matches in the return from useXhr(). A sample URL is //wfs1/users$/[username]/AppData/Roaming/Brackets/extensions/user/theseus/src/InstallationCorrupt.html.

alltom commented 10 years ago

Great sleuthing! I recommend opening an issue on RequireJS and pointing them here. :)

davidsearle commented 10 years ago

@yelper Have you been able to find a solution for this? I have a few plugins that have the same issue, and I also have a network path for my AppData folder? Same problems as you when installing certain plugins.

Thanks,

David

yelper commented 9 years ago

I haven't found an solution yet, but I'm back on the hunt. I'll let you know what happens or feel free to follow!

alltom commented 9 years ago

Thanks for the heads up!