Closed
Bug 676300
Opened 14 years ago
Closed 14 years ago
Cannot use history.pushState / history.replaceState in page-mod
Categories
(Add-on SDK Graveyard :: General, defect, P2)
Add-on SDK Graveyard
General
Tracking
(Not tracked)
RESOLVED
FIXED
1.1
People
(Reporter: nkoriyama, Assigned: ochameau)
Details
(Whiteboard: [cherry-pick-1.1])
Attachments
(1 file)
3.11 KB,
patch
|
irakli
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0a1) Gecko/20110803 Firefox/8.0a1
Build ID: 20110803030753
Steps to reproduce:
In my addon using page-mod, I use history.pushState / history.replaceState.
Actual results:
Exception occurs.
An exception occurred.
Traceback (most recent call last):
<snip>
File "resource://jid1-41t58upr92mimq-at-jetpack-api-utils-lib/content/content-proxy.js", line 92, in null
let unwrapResult = Function.prototype.apply.apply(fun, [obj, args]);
[Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIDOMHistory.replaceState]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: resource://jid1-41t58upr92mimq-at-jetpack-api-utils-lib/securable-module.js -> resource://jid1-41t58upr92mimq-at-jetpack-api-utils-lib/content/content-proxy.js :: <TOP_LEVEL> :: line 92" data: no]
Expected results:
should work correctly with no exception.
Reporter | ||
Comment 1•14 years ago
|
||
When I use same script on Greasemonkey, it works as I excepted.
Updated•14 years ago
|
Assignee: nobody → poirot.alex
Priority: -- → P2
Target Milestone: --- → 1.1
Assignee | ||
Comment 2•14 years ago
|
||
Thanks for the report.
I wasn't able to found the precise reason of this exception.
It is something new introduced in future version of Firefox.
(It works correctly in Firefox5)
By default I would say that it is related to additional security checks described in bug 676572.
But I launch a new Firefox debug build on current Nightly in order to find the exact reason of this error.
In the meantime, you can use: unsafeWindow.history.pushState.
This `unsafeWindow` is experimental and not documented. It allows to bypass default security wrappers.
Assignee | ||
Comment 3•14 years ago
|
||
I found the precise problem with gdb.
We end up here:
http://mxr.mozilla.org/mozilla-central/source/js/src/jsclone.cpp#533
`obj` refer to the proxy created by us before passing values to XrayWrappers.
And obj->isObject() returns false on a Proxy because its class is `js_ProxyClass`:
http://mxr.mozilla.org/mozilla-central/source/js/src/jsobj.h#1349
I don't think we can build a generic fix as these "xraywrappers proxies" are important and we can't distinguish between native methods that have to receive json only values from methods that may receive JS objects with methods.
Nevertheless, we can easily fix this by adding another work around in content-proxy module.
Assignee | ||
Comment 4•14 years ago
|
||
Add this specific work around.
Attachment #552495 -
Flags: review?(rFobic)
Assignee | ||
Updated•14 years ago
|
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Reporter | ||
Comment 5•14 years ago
|
||
(In reply to Alexandre Poirot (:alex) from comment #4)
> Created attachment 552495 [details] [diff] [review]
> Fix history API by adding a specific work around
>
> Add this specific work around.
Applying this fix, my add-on works properly.
Comment 6•14 years ago
|
||
Comment on attachment 552495 [details] [diff] [review]
Fix history API by adding a specific work around
Review of attachment 552495 [details] [diff] [review]:
-----------------------------------------------------------------
r+, but this code get's less and less maintainable. Do we have a list of platform bugs that we will eventually allow us to get rid of our proxy wrapper hacks ? If not we should create them and point out in comments what is workaround for what.
Attachment #552495 -
Flags: review?(rFobic) → review+
Assignee | ||
Comment 7•14 years ago
|
||
I opened bug 679054 for the platform issue. I'm not 100% convinced this is a platform issue. We have to address it but I don't think that these APIs have to accept Proxy objects.
Assignee | ||
Comment 8•14 years ago
|
||
Landed:
https://github.com/mozilla/addon-sdk/commit/95f6db0f00a41c2b780e63ec2c05fabe4c6e1d5d
I've added a reference to the platform bug number in comments.
Most work arounds have a reference to a bug number, when I was able to identify a real issue from platform code.
Assignee | ||
Updated•14 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Updated•14 years ago
|
Whiteboard: [cherry-pick-1.1]
You need to log in
before you can comment on or make changes to this bug.
Description
•