Closed
Bug 501118
Opened 17 years ago
Closed 17 years ago
about:jetpack caches code that's run from example box
Categories
(Mozilla Labs :: Jetpack Prototype, defect, P2)
Tracking
(Not tracked)
RESOLVED
FIXED
0.5
People
(Reporter: jeffreytgilbert, Assigned: avarma)
Details
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4
Build Identifier:
The about:jetpack window lets you run sample code directly for the page. This is fine with the exception that it should not save this code automatically. On refreshing of the page the code is run again and again. If code with an error in it was run, the page will no longer be editable as the javascript then runs erratically.
$('div').hide('slow',function(){
$(this).slideIn('slow'); // not a function. throws an error. oops!
});
function continues to loop and hide all elements so you can't go in with firebug to unhide them. Tried running $('*'),show(); in both the js error console as well as in firebug's run window with no result. Can't find where this code is stored to reset it.
Reproducible: Always
Steps to Reproduce:
1. Enter bad code in run box
2. Hit run (code is saved, code errors, page dies)
3. Refresh page, close browser, reopen, see same error, remove jetpack, reinstall jetpack, see same error, submit bug report and twiddle thumbs.
Actual Results:
abject failure
Expected Results:
great success!
If jetpack didn't cache the code OR if it allowed you to reset where the code is saved OR didn't allow you to manipulate a crucial page to editing jetpack installs and instead sandbox it to someplace harmless where you could abandon problem scripts.
| Reporter | ||
Comment 1•17 years ago
|
||
So, after digging around I found where it stores the files (which will be obvious to any developers for jetpack). Looks like it was stored in these text files:
/Users/jgilbert/Library/Application Support/Firefox/Profiles/32dwx4ul.default
jetpack-editor-code.txt
jetpack-example-code.txt
jetpack-tutorial-code.txt
On windows or linux, no idea, but if a mac user has this issue maybe this info will help. I dug around in the js files and xul files and sqlite db files and had no idea where this was stored. Thankfully persistence paid off. I still think that one of a few things should happen:
1. Edit boxes shouldn't be on the main page allowing developers to accidentally break the whole plugin
2. Uninstalling the plugin removes the example code text files which store these bundles of hurt
3. Isolated sandboxes are created where code examples can be created and edited without worrying about disabling the whole plugin (away from the main page)
4. The code from the example run boxes isn't stored and if it is, it's not run upon load of the page.
Updated•17 years ago
|
Assignee: nobody → avarma
Priority: -- → P2
Target Milestone: -- → 0.5
| Assignee | ||
Comment 2•17 years ago
|
||
Thanks for the bug report, and sorry for the inconvenience!
This is definitely an annoying problem. One thing that helps with it is the fixing of bug 496253, which basically implements your suggestion #3 to some extent: the code example in your first comment no longer does anything because the JQuery object given to Jetpacks is sandboxed on a per-Jetpack basis instead of each one simply inheriting the JQuery object of about:jetpack. However, it's still entirely possible for a Jetpack to access the about:jetpack tab and close it through jetpack.tabs.focused.close(), et cetera.
One potential solution is to actually prevent chrome-privileged tabs from being manipulated in any way by Jetpacks, but the annoying thing about this is that it'd make the tutorial a bit less awesome (since you couldn't "Boom!" your own page) and make certain kinds of experimentation harder. Though it could be countered that the solution to that is to not put the tutorial and code editor on about:jetpack at all.
Still trying to think of a low-cost way to resolve this issue in time for 0.5...
Status: UNCONFIRMED → NEW
Ever confirmed: true
| Reporter | ||
Comment 3•17 years ago
|
||
Having the editor there is a nice intro piece for sure, but there is no forgiveness for an error because it saves that data to a session stored in those text files. Instead of having it automatically load and execute that data (bad), you could have it load the data, but not execute it until "try" was clicked and have a "reset" button somewhere in the design to have it restore the default javascript for the example. That's my 2 cents worth.
Comment 4•17 years ago
|
||
After a discussion with Atul, we decided to use menu option in the Tools menu to reset Jetpack's state. Although it is not, perhaps, the most discoverable of mechanisms, this is for a developer edge-case and so we are willing to have a good-enough solution.
| Assignee | ||
Comment 5•17 years ago
|
||
Jeffrey, the only problems I have with your suggestion are:
* It means that the user isn't actually developing a "real" jetpack, i.e. they have to do extra work to get it to always load when they start Firefox. Perhaps this is something we can live with if we make it super-easy to turn it into a real jetpack, though.
* Putting crashy code into the development editor is actually a specific case of a more general one: what happens, for instance, if the user installs a malicious or misbehaving Jetpack that does the same kind of thing? This actually turns the developer edge-case into a potential end-user edge-case, so we actually might need to have a fairly humane solution here.
| Reporter | ||
Comment 6•17 years ago
|
||
If you isolate the launch page at about:jetpack from code execution from jetpack plugins and put the uninstaller there for enabling and disabling installed plugins, i dont see how that would negatively impact development nor leave it open for breakage.
| Assignee | ||
Comment 7•17 years ago
|
||
My only concern with that is that folks experimenting with the tutorial or code editor will have to take an extra step to play around with things (switching to a window or tab that isn't about:jetpack to test out their code), though I suppose the real solution there is to move these things out of about:jetpack and into other pages.
I'm also concerned about the visibility of errors, though the real solution here to make errors more visible--but right now it could be the case that new users who are trying to experiment don't realize why their JQuery code to modify about:jetpack isn't working.
That said, though, for expediency's sake it might be easier right now to add a "Repair Jetpack" item to the Tools menu that comments out all developer editor content and uninstalls (but doesn't purge) all Jetpacks. I also don't think that this solution is mutually exclusive with that of preventing the modification of about:jetpack, but I could be wrong.
| Assignee | ||
Comment 8•17 years ago
|
||
Hmm, I had a different idea: Firefox has a "safe mode" that allows it to start up with third-party extensions temporarily disabled, so why not have a "safe mode" for Jetpack too?
I've added this experimental functionality here:
http://hg.mozilla.org/labs/jetpack/rev/a31451ff5247
Jetpack's safe mode is currently triggered if about:jetpack is loaded twice within 2 seconds--I did this initially because I assumed frustrated users would be jamming "reload" in frustration--but there's other ways we can make it visible, like adding an "about:jetpack (safe mode)" entry under "about:jetpack" in the Tools pull-down menu.
What do you think? It's pretty easy to implement, it doesn't prevent Jetpacks from doing anything they can currently do, and it builds on users' pre-existing understanding of the "safe mode" concept.
| Reporter | ||
Comment 9•17 years ago
|
||
It doesnt have to be a new tab or window. Throw it in an iframe! Though the thought of hacking the about jetpack page is novel, the real audience i think is the web at large. Now if we're talking edge cases, isnt having the editor capable of changing and running code on about:jetpack an edge case? Im far more interested in a stable secure dev environment that laughs at my mistakes than one that resets all my plugins. A frame or iframe would do wonders here. I still vote you keep execution out of about:jetpack and keep it sandboxed to its own area
| Assignee | ||
Comment 10•17 years ago
|
||
The thing is, when you're experimenting with about:jetpack, there's a very good use case for ust playing around with the current page without having to switch to a different tab. I think there's some stuff we can do in the future to make things more robust in the ways you're suggesting, but right now the "safe mode" plan is both easy to implement and takes care of most (if not all) of the problem.
If you still have a major problem with the "safe mode" solution, please feel free to file a new bug! Thanks for your ideas.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•