Closed
Bug 906166
Opened 11 years ago
Closed 11 years ago
iD editor for OpenStreetMap - deleting a localStorage property sometimes getting error "TypeError: property iD_http://osm.dev_lock is non-configurable and can't be deleted"
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
FIXED
mozilla27
People
(Reporter: john.firebaugh, Assigned: bzbarsky)
References
Details
Attachments
(1 file)
(deleted),
patch
|
akeybl
:
approval-mozilla-aurora+
akeybl
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:26.0) Gecko/20100101 Firefox/26.0 (Beta/Release)
Build ID: 20130816030205
Steps to reproduce:
Occasionally, deleting a localStorage property via a delete expression (rather than via removeItem) results in an error.
For example, sometimes the expression `delete localStorage["iD_http://osm.dev_lock"]` results in the error 'TypeError: property "iD_http://osm.dev_lock" is non-configurable and can't be deleted', while `localStorage.removeItem("iD_http://osm.dev_lock")` always works fine.
Comment 1•11 years ago
|
||
Thanks for reporting this John.
Could you provide a minimal testcase or an URL to better understand and reproduce this?
Flags: needinfo?(john.firebaugh)
Reporter | ||
Comment 2•11 years ago
|
||
Unfortunately I was not able to minimize this, but I can tell you that it occurred in the iD editor for OpenStreetMap. The following issues were caused by it, and switching from delete to removeItem solved the issue:
https://github.com/systemed/iD/issues/1691
https://github.com/systemed/iD/issues/1692
Flags: needinfo?(john.firebaugh)
Updated•11 years ago
|
Summary: deleting a localStorage property sometimes results in an error that the property is "non-configurable and can't be deleted" → iD editor for OpenStreetMap - deleting a localStorage property sometimes getting error "TypeError: property iD_http://osm.dev_lock is non-configurable and can't be deleted"
Comment 3•11 years ago
|
||
I have exactly same problem, and also failed at attempt to produce minimal test case.
It's valid issue.
Updated•11 years ago
|
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
Assignee | ||
Comment 4•11 years ago
|
||
Is there a non-minimal but _reliable_ testcase?
Comment 5•11 years ago
|
||
Boris, try http://ldz.eregistrations.org/ and open console, you'll see "TypeError: property "X" is non-configurable and can't be deleted" errors, and blank page cause of that.
This page worked well on Firefox about 2 weeks ago.
Assignee | ||
Comment 7•11 years ago
|
||
One-day m-c range: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=3d40d270c031&tochange=c2b375f3a909
Keywords: regressionwindow-wanted
Assignee | ||
Comment 8•11 years ago
|
||
Note, of course, that my range is different from "2 weeks ago"..
On the site in comment 5, what I see is that we're in a strict-mode script (specifically http://ldz.eregistrations.org/public.js which has code like this:
if (userId) localStorage._authenticated = userId;
else delete localStorage._authenticated;
But if localStorage._authenticated is not actually set (which in my case of course it's not), then what will this do? Per spec, the object has a named deleter, and this deleter has an identifier and the operation returns void. So we should land in http://dev.w3.org/2006/webapi/WebIDL/#delete step 2.5 and the delete should never throw.
OK, so what does our implementation do? This class is still using XPConnect bindings, so we'll call XPC_WN_Helper_DelProperty. In bug 858677 this function picked up a "JSBool *succeeded" out param that it never sets (red flags should be going off now). And then the calling code in Interpret() is:
2190 bool succeeded;
2191 if (!JSObject::deleteProperty(cx, obj, name, &succeeded))
2192 goto error;
2193 if (!succeeded && script->strict) {
2194 obj->reportNotConfigurable(cx, NameToId(name));
So hey, we're testing random memory. On the site in comment 5 we seem to get lucky in that the memory is reliably 0 (or at least became so in the regression range in comment 7).
Assignee | ||
Comment 9•11 years ago
|
||
So should XPC_WN_Helper_DelProperty just *succeeded = true up front and be done with it? That certainly fixes the site in comment 5, and I bet it'll fix OpenStreetMap too.
Flags: needinfo?(jwalden+bmo)
Flags: needinfo?(bobbyholley+bmo)
Comment 10•11 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #9)
> So should XPC_WN_Helper_DelProperty just *succeeded = true up front and be
> done with it? That certainly fixes the site in comment 5, and I bet it'll
> fix OpenStreetMap too.
Yeah I think so. Apparently the SH hook never got a similar update, and it probably isn't worth doing at this point. r=me on |*succeeded = true|.
Flags: needinfo?(bobbyholley+bmo)
Assignee | ||
Comment 11•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Assignee | ||
Comment 12•11 years ago
|
||
Assignee | ||
Comment 13•11 years ago
|
||
Flags: in-testsuite?
Target Milestone: --- → mozilla27
Assignee | ||
Comment 14•11 years ago
|
||
Comment on attachment 811993 [details] [diff] [review]
Make sure to initialize the "succeeded" outparam of XPC_WN_Helper_DelProperty.
[Approval Request Comment]
Bug caused by (feature/regressing bug #): 858677
User impact if declined: Some sites (e.g. OpenStreetMap) randomly fail to work.
Other sites reliably fail to work.
Testing completed (on m-c, etc.): Makes the one reliable testcase we have that
shows the bug work right.
Risk to taking this patch (and alternatives if risky): I believe this is
extremely low risk.
String or IDL/UUID changes made by this patch: None
Attachment #811993 -
Flags: approval-mozilla-beta?
Attachment #811993 -
Flags: approval-mozilla-aurora?
Assignee | ||
Updated•11 years ago
|
Component: JavaScript Engine → XPConnect
Comment 15•11 years ago
|
||
I'm told this'll become WebIDL soon, and in there this delete always succeeds, so this seems a totally fine stopgap til WebIDL. Nice to see this so simply fixed, for branches' sake.
Flags: needinfo?(jwalden+bmo)
Comment 16•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Comment 17•11 years ago
|
||
Great thanks! Is this scheduled to land in stable FF soon?
Assignee | ||
Comment 18•11 years ago
|
||
I've requested approval to land it on Aurora 26 and Beta 25. If that's granted (which I expect it will be), this will ship in Firefox 25, on Oct 29 or so.
The only way to get it out there faster is to do a special "chemspill" release. It's not quite clear to me whether that's worth it; it would shave maybe 2 weeks off the time to getting this out.
If you need an urgent workaround, removeItem should work, or putting the script in non-strict mode for now, right? :(
Comment 19•11 years ago
|
||
Boris, thanks for info. Application is still in dev phase, and I think we can manage with 2 weeks wait.
I just wanted to make sure it'll be addressed for stable channel quite soon. I can hardcode workarounds directly in code, but prefer not to do that.
Comment 20•11 years ago
|
||
(In reply to Mariusz Nowak from comment #19)
> Boris, thanks for info. Application is still in dev phase, and I think we
> can manage with 2 weeks wait.
(Note that it'll be 4 weeks, not 2. 2 is what it would be if we chemspilled).
Comment 21•11 years ago
|
||
4 weeks also should be fine, if not, then I'll probably somehow manage that on my side.
I just wonder if it's indeed just few sites that were affected, as it's quite serious when it happens.
Assignee | ||
Comment 22•11 years ago
|
||
Mariusz, the affected sites need to be using delete on a Storage object in a strict-mode script... and then the stack has to end up such that that particular garbage value is 0, not any other value.
So I suspect the number of sites affected is in fact fairly low (if nothing else because of the strict-mode requirement). And even for some of those it may not happen all the time (e.g. OpenStreetMap), because of the "stack must have a 0" requirement.
That said, I definitely agree this is a serious bug. That's why I want to backport this to 25 and 26. The bar for doing a chemspill is a lot higher than that, though: it needs to be either a compat issue that breaks a large fraction of sites (by time visited, not number; so e.g. breaking the single site mail.yahoo.com would count) for a significant fraction of our user base or an actively exploited security problem... I'm not quite sure that this bug hits that bar, though I'll let the release folks judge that.
Comment 23•11 years ago
|
||
Boris, thanks for clarification.
Comment 24•11 years ago
|
||
Comment on attachment 811993 [details] [diff] [review]
Make sure to initialize the "succeeded" outparam of XPC_WN_Helper_DelProperty.
Given the low risk evaluation here, approving for pre-release branches.
Attachment #811993 -
Flags: approval-mozilla-beta?
Attachment #811993 -
Flags: approval-mozilla-beta+
Attachment #811993 -
Flags: approval-mozilla-aurora?
Attachment #811993 -
Flags: approval-mozilla-aurora+
Assignee | ||
Comment 25•11 years ago
|
||
You need to log in
before you can comment on or make changes to this bug.
Description
•