Closed
Bug 424019
Opened 16 years ago
Closed 16 years ago
NPN_RemoveProperty returns incorrect result when applied to DOM elements
Categories
(Core Graveyard :: Plug-ins, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: kbrussel, Assigned: jst)
References
Details
Attachments
(3 files)
2.79 KB,
application/zip
|
Details | |
2.79 KB,
application/zip
|
Details | |
1.41 KB,
patch
|
brendan
:
review+
brendan
:
superreview+
|
Details | Diff | Splinter Review |
When NPN_RemoveProperty is applied to a property of a DOM element (such as the "value" property of an HTML form input field), the return result is "true", indicating that the removal occurred successfully, but in fact the operation does not succeed. This is related to bug 411040, though it appears that the fix for that bug did not cover this case. Please see the attached test case and try it with the new Java Plug-In from http://jdk6.dev.java.net/6uNea.html . On IE, the JSObject removeMember operation fails, and the code detects and handles this. On Firefox, the JSObject removeMember operation claims that it doesn't fail, but the "value" property of the HTML input field is unmodified. We aren't requesting that the removeMember operation actually mutate the DOM, only that NPN_RemoveProperty return false in this case.
Reporter | ||
Comment 1•16 years ago
|
||
Test case
Reporter | ||
Comment 2•16 years ago
|
||
Note that the Java Console should be opened via the Advanced tab in the Java Control Panel to see the printed output from the above test case.
Assignee | ||
Comment 3•16 years ago
|
||
We should fix this for 1.9. What's happening here is that the propery is properly being deleted, and we claim it was deleted, but the property in question is a DOM property exposed through XPConnect, so after it's been deleted, it simply gets added back the next time someone looks for it. This is trivial to fix by simply looking up the property after it was deleted and using that to determine if the property really got deleted.
Assignee: nobody → jst
Flags: blocking1.9+
OS: Windows XP → All
Priority: -- → P2
Hardware: PC → All
Target Milestone: --- → mozilla1.9
Reporter | ||
Comment 4•16 years ago
|
||
Out of curiosity, why does the value remain unchanged after the deletion and re-addition of the property? Is the value cached in the XPConnect layer?
OS: All → Windows XP
Priority: P2 → --
Hardware: All → PC
Target Milestone: mozilla1.9 → ---
Assignee | ||
Comment 5•16 years ago
|
||
The property you're deleting is merely the JS getter/setter for the value, the actual value lives in the C++ implementation behind the JS object, and thus, the value is unaffected by deleting the JS getter and setter for the property in question.
Assignee | ||
Comment 6•16 years ago
|
||
Kenneth, the testcase doesn't appear to work, but changing JSObjectRemoveMember to JSObjectDOMRemoveMember in the "code" applet attribute in the HTML file appears to fix it. Here's an updated testcase.
Assignee | ||
Comment 7•16 years ago
|
||
This fixes this problem by re-resolving the property after it's been deleted to check if it's a property that gets re-created when resolving it again.
Attachment #311833 -
Flags: superreview?(brendan)
Attachment #311833 -
Flags: review?(brendan)
Reporter | ||
Comment 8•16 years ago
|
||
(In reply to comment #6) > > Kenneth, the testcase doesn't appear to work, but changing JSObjectRemoveMember > to JSObjectDOMRemoveMember in the "code" applet attribute in the HTML file > appears to fix it. Here's an updated testcase. I'm really sorry about that. I must have made a mistake copying it between machines.
Assignee | ||
Comment 9•16 years ago
|
||
No problem, it was an easy fix :)
Comment 10•16 years ago
|
||
Wouldn't it be better to make such properties JSPROP_PERMANENT? /be
Reporter | ||
Comment 11•16 years ago
|
||
Note that it's no problem from our side if the properties can't be removed -- this would be more consistent with how IE behaves, anyway.
Assignee | ||
Comment 12•16 years ago
|
||
(In reply to comment #10) > Wouldn't it be better to make such properties JSPROP_PERMANENT? Yeah, it would, but I don't want to make such a change now, at least not w/o a beta. I'd rather do this for now and file a followup bug on this for later.
Comment 13•16 years ago
|
||
Comment on attachment 311833 [details] [diff] [review] Fix. Please file a followup bug and reference it in a FIXME: nnnnnn comment here. Thanks, /be
Attachment #311833 -
Flags: superreview?(brendan)
Attachment #311833 -
Flags: superreview+
Attachment #311833 -
Flags: review?(brendan)
Attachment #311833 -
Flags: review+
Assignee | ||
Comment 14•16 years ago
|
||
Filed bug 425823 and checked this in with comments added referencing that bug.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Updated•16 years ago
|
Attachment #311832 -
Attachment is patch: false
Attachment #311832 -
Attachment mime type: text/plain → application/zip
Updated•2 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•