Open Bug 682296 Opened 13 years ago Updated 2 years ago

history API throws NS_UNEXPECTED-ERROR when used from addons, scratchpad and Web console

Categories

(Core :: DOM: Navigation, defect)

x86
Linux
defect

Tracking

()

People

(Reporter: public, Unassigned)

Details

using history.pushState or history.replaceState from an addon, the Web console or scratchpad return such errors: [16:59:17.753] [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIDOMHistory.pushState]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: Web Console :: <TOP_LEVEL> :: line 1" data: no] test case: 1. Open the Web console 2. paste> history.pushState({}, "", "?bug") 3. there is no 3. unfortunately Note: Doing the same in Firebug works fine.
BTW, the workaround for addons is to create a script tag with the call to history API in its innerHTML and then append that tag to the document body.
Is this specific to pushstate? history.back() also doesn't work for me.
As the bug title says, the problem is expected to affect the whole history API. I've only tested pushState() and replaceState() methods, though.
history.back() is working fine for me, but I can reproduce this with history.pushState(...).
From a Greasemonkey script this I get this error only when I give a URL to history.pushState (giving only state object and title works fine). But from Scratchpad and Web Console I get this error also when I don't give a URL.
*From a Greasemonkey script I get this error only when I give a URL to history.pushState
The error has an explanation now: [Exception... "The operation is insecure." code: "18" nsresult: "0x80530012 (SecurityError)" location: "debugger eval code Line: 1"]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.