Closed
Bug 411040
Opened 17 years ago
Closed 17 years ago
Inconsistent results of NPN_RemoveProperty and window scope
Categories
(Core Graveyard :: Plug-ins, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: kbrussel, Assigned: jst)
Details
Attachments
(2 files)
2.29 KB,
application/zip
|
Details | |
1.18 KB,
patch
|
brendan
:
review+
brendan
:
superreview+
brendan
:
approval1.9+
|
Details | Diff | Splinter Review |
The NPRuntime API NPN_RemoveProperty returns inconsistent results when attempting to remove variables from the window scope, depending on how those variables are declared. If the variable is declared in the window scope as myObj = { ... } then NPN_RemoveProperty(npp, npWindowNPObj, "myObj") (where npp and npWindowNPObj are defined in the obvious fashion) works correctly, and a subsequent NPN_HasProperty call for "myObj" in the window scope will return false. However, if the variable is declared in the window scope as var myObj = { ... } then NPN_RemoveProperty(npp, npWindowNPObj, "myObj") returns true, but a subsequent NPN_HasProperty call for "myObj" in the window scope returns true, and a subsequent NPN_GetProperty call for "myObj" in the window scope will still return the NPObject associated with myObj. To reproduce: 1. Download and install the current early access build of 6uN (09 or later) from http://jdk6.dev.java.net/6uNea.html (the Windows Offline Installer). 2. Open the Java Control Panel, Advanced tab, Java Plug-in node, and check the checkbox to enable the next-generation Java Plug-In. (Note that in a future build this checkbox will be enabled by default, so in this case make sure it's checked.) 3. Enable the Java Console in the same Advanced tab (Java console node, Show console button). 4. Launch Firefox 3 and navigate to the index.html from the web page. 5. Consult the Java Console for output. Note that in Internet Explorer, the JSObject.removeMember() operation, which boils down to a call to the COM IDispatchEx::DeleteMemberByName(), fails in both cases, which we consider admissible though not desirable. The Firefox bug is that in case 2, above, NPN_RemoveProperty should return false if it failed to actually remove the property.
Assignee | ||
Comment 1•17 years ago
|
||
This makes NPN_RemoveProperty() remove false if the property couldn't be removed. The reason you're seeing this behavior is that properties that are declared with "var" (or "function") are undeletable properties, per spec, and for historic reasons calling delete on the doesn't throw an exception or fail in any way.
Assignee: nobody → jst
Status: NEW → ASSIGNED
Attachment #296233 -
Flags: superreview?(brendan)
Attachment #296233 -
Flags: review?(brendan)
Comment 2•17 years ago
|
||
Note that var will not create a property already bound under the given name, so var document, e.g. does not replace the document binding, which IIRC is deletable. /be
Updated•17 years ago
|
Attachment #296233 -
Flags: superreview?(brendan)
Attachment #296233 -
Flags: superreview+
Attachment #296233 -
Flags: review?(brendan)
Attachment #296233 -
Flags: review+
Attachment #296233 -
Flags: approval1.9+
Assignee | ||
Comment 3•17 years ago
|
||
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 4•17 years ago
|
||
Fix verified with FF 3 nightly from 1/11/2008. Thanks for the prompt fix.
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
•