Closed Bug 562646 Opened 15 years ago Closed 14 years ago

Bespin embedded 0.7.1 does not work inside xulrunner-based apps because of localStorage

Categories

(Skywriter Graveyard :: Embedded, defect)

defect
Not set
critical

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: glazou, Assigned: julian.viereck)

Details

Bespin Embedded 0.7.1 calls window.localStorage and window.localStorage.history, and those are not available from an <iframe> or <browser> xul tag inside a xulrunner-based application... So 0.7.1 is for the time being unusable with xulrunner :-( LocalStorage is (seen from here) used for user settings and history of edited documents, all things that are irrelevant in the case of the embedded Bespin and should be moved outside of BespinEmbedded.js, preserving the client-server tool and allowing the embedded version to work again with XR.
It also happens when using an HTML file instead of a XUL file for your UI in a xulrunner app. The error can be observed by installing my despin plugin: http://github.com/past/despin
Unfortunately, given the changes that this would require and where we're at with releases, a fix for this is likely not going to land in 0.7.x and will have to wait for the "Theora" release of Bespin.
Target Milestone: --- → 0.8
Workarounded this by using resource: URL instead of chrome:. https://ubiquity.mozilla.com/hg/ubiquity-firefox/rev/2ce34b3fc51c
Sadly this didn't work for me, albeit using gBrowser.addTab: - var newTab = gBrowser.addTab('chrome://despin/content/editor.html'); + var newTab = gBrowser.addTab('resource://despin/content/editor.html');
(In reply to comment #3) > Workarounded this by using resource: URL instead of chrome:. > > https://ubiquity.mozilla.com/hg/ubiquity-firefox/rev/2ce34b3fc51c Satyr, you just made my day !!! I confirm this work around works, see http://pikchur.com/QWv Kevin, you should probably document this workaround somewhere in the doc pages.
If I recall correctly, the localStorage reference that was causing this problem was in SproutCore. This is likely not a problem now. (I don't know if jQuery has any trouble running in XULRunner... that would be good to know.)
Assignee: nobody → jviereck
As with changeset a0d37bb62076, the fileHistory is now in a separate plugin. That means, if you don't inlcude the "file_history" plugin when building the embedded release, you shouldn't have problems with the localStorage anymore. I also added some more tests to make sure that the localStorage object is not accessed if it's not around. Due to these changes, I mark this bug as fixed.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED

In reply to comment 4 and 5:
Thanks so much, Panos Astithas! I ran into the same error and this worked:

chrome.manifest:

resource myapp ../myapp/

app.xul:

<browser type="content-primary" src="resource://myapp/index.html" />

This works for me.

So, localStorage works in resource: URLs, but not in chrome: URLs. Compare bug 495337, which implemented this.


Unrelated note to self: To show console output on Windows:

pref("browser.dom.window.dump.enabled", true); // start xulrunner with -console to see dump()s
firefox.exe -app ../xulapp/application.ini -console

That said, this trick only stops the exception, but localStorage doesn't actually store, when used from in resource: URLs.

You need to log in before you can comment on or make changes to this bug.