brackets-archive / bracketsIssues

Archive of issues in brackets.
0 stars 0 forks source link

[CLOSED] Make Brackets fail gracefully in a browser environment #1812

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by DennisKehrig Wednesday Oct 17, 2012 at 15:57 GMT Originally opened as https://github.com/adobe/brackets/pull/1859


Fixes #1632


DennisKehrig included the following code: https://github.com/adobe/brackets/pull/1859/commits

core-ai-bot commented 3 years ago

Comment by gruehle Wednesday Oct 17, 2012 at 17:38 GMT


This works if you are loading via http://, but shows a blank screen if loading via file://. This is due to a failing cross-origin request for main-view.html. Ideally, in this case, we would display a friendly error message.

core-ai-bot commented 3 years ago

Comment by DennisKehrig Wednesday Oct 17, 2012 at 17:55 GMT


Uh, good catch. Didn't test that.

core-ai-bot commented 3 years ago

Comment by DennisKehrig Wednesday Oct 17, 2012 at 18:02 GMT


Local files: Works in Chrome with --allow-file-access-from-files Works in Firefox without any parameters, though there's an odd black box in the top left corner Works in Safari without any parameters, though there's a big black bar on the left side EDIT: the big black bar turns out to be the project area ^^

core-ai-bot commented 3 years ago

Comment by DennisKehrig Wednesday Oct 17, 2012 at 18:39 GMT


I don't think we can solve this easily. The only way I see would be to use JSONP instead of XMLHttpRequest whenever we access remote files. We would need to convert the following files to a JS file that calls a named function specified in the URL (e.g. brackets.less.js?callback=applyBracketsStyle):

In the case of the LESS file, that means preprocessing because we'd also need to include all the files referenced by it - in other words, we might as well compile it to CSS in all cases. Inconvenient.

For the HTML files we'd lose syntax highlighting when editing them since they would end up being just a string in a JS file. Same for every further file we want to load.

Honestly, this seems like too much of a hassle to me.

I can't even find a way to install a global AJAX error handler that would inform the user how to start Chrome so it works. The best I found was this:

  window.addEventListener('error', function (e) { ... });

But the provided ErrorEvent is very generic (message: "Script error.", type: "error", lineno: 0, no code or anything, no stack). So we'd need to modify less.js for that.

@gruehle: What do you think?

core-ai-bot commented 3 years ago

Comment by DennisKehrig Wednesday Oct 17, 2012 at 19:14 GMT


Alright, the layout bug in Firefox is due to flexbox intricacies. I don't think this should be fixed as part of this issue, because there are way more places where something is going to fail in Firefox (for instance, resizing the project panel doesn't work and throws an error mentioning something with "webkit").

Since isse #1632 is titled "Brackets doesn't load when hosted on a web server" I'd kindly ask for this to be merged and the issue to be closed.

core-ai-bot commented 3 years ago

Comment by gruehle Wednesday Oct 17, 2012 at 20:13 GMT


Initial review complete. Nice work on the Chrome error dialog!

core-ai-bot commented 3 years ago

Comment by DennisKehrig Friday Oct 19, 2012 at 15:46 GMT


@rolo2012 If your goal is more than fixing #1632, you might also want to check out the in-browser branch of jdiehl's brackets.

core-ai-bot commented 3 years ago

Comment by jasonsanjose Friday Oct 19, 2012 at 16:11 GMT


Also, we merged@jdiehl's branch into our repo at https://github.com/adobe/brackets/tree/in-browser

core-ai-bot commented 3 years ago

Comment by rolo2012 Friday Oct 19, 2012 at 16:39 GMT


Thanks i think that nothing exist to do this.

core-ai-bot commented 3 years ago

Comment by DennisKehrig Friday Oct 19, 2012 at 17:14 GMT


@jdiehl's solution requires a separate Node.js based server. Do you have a different approach?

core-ai-bot commented 3 years ago

Comment by rolo2012 Friday Oct 19, 2012 at 17:21 GMT


My solution is use a PHP local web server maybe not be a god idea after all I should try this version first

core-ai-bot commented 3 years ago

Comment by DennisKehrig Friday Oct 19, 2012 at 17:29 GMT


PHP should still be the best supported language by web hosters, so I think that would be cool, too :) I recently converted the Node.js backend of a webapp to PHP for that very reason.

core-ai-bot commented 3 years ago

Comment by rolo2012 Friday Oct 19, 2012 at 18:15 GMT


You post the solution in php somewhere??

core-ai-bot commented 3 years ago

Comment by DennisKehrig Friday Oct 19, 2012 at 18:27 GMT


Sorry, that was a misunderstanding: I wasn't talking about Brackets, but a different webapp :)

core-ai-bot commented 3 years ago

Comment by rolo2012 Monday Oct 22, 2012 at 18:03 GMT


I made my solution The download is here: http://184.173.19.189/~ramiro/xcom/css/bracket_php_shell.tar.bz2 Repo is here: https://github.com/rolo2012/brackets-php-shell

core-ai-bot commented 3 years ago

Comment by DennisKehrig Monday Oct 22, 2012 at 20:17 GMT


If you're on Windows, maybe TortoiseGit will help you out, or for example SourceTree on the Mac. These are not Adobe endorsements, I just happen to like those tools personally.

core-ai-bot commented 3 years ago

Comment by jdiehl Tuesday Oct 23, 2012 at 06:53 GMT


I looked at your code and it seems like a solid approach to the problem. However, I would prefer not to use a web application framework (CodeIgniter). Using such a large frameworks will keep people from installing this on their web servers, because it is hard to integrate the framework with other frameworks and 99% of the code provided is not necessary for the brackets functions. Instead, I would encourage you to implement these functions in a single file that accepts a preset Ajax API or a WebSocket connection.

core-ai-bot commented 3 years ago

Comment by rolo2012 Wednesday Oct 24, 2012 at 13:08 GMT


I will correct that.I think the same only one file but I start with CI thinking that the code will be bigger and finaly one controller is enough to do all. Installing is not a problem is only copy paste and the size is ~700kb uncompresed the problem is use whit other frameworks.

core-ai-bot commented 3 years ago

Comment by DennisKehrig Wednesday Oct 24, 2012 at 16:03 GMT


Whoah, something weird just happened: the error message appeared in the shell, too. Not good...

core-ai-bot commented 3 years ago

Comment by DennisKehrig Thursday Oct 25, 2012 at 14:53 GMT


@gruehle: Thanks for the reviews, Glenn! All yours again.

core-ai-bot commented 3 years ago

Comment by gruehle Thursday Oct 25, 2012 at 21:03 GMT


Looks great, thanks Dennis! As a bonus, this also fixes issue #1430.