[Webkit-unassigned] [Bug 38636] Object.defineProperty doesn't respect attributes when applied to the Global Object

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Oct 28 04:44:08 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=38636


Xan Lopez <xan.lopez at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xan.lopez at gmail.com




--- Comment #2 from Xan Lopez <xan.lopez at gmail.com>  2010-10-28 04:44:07 PST ---
FWIW, something like this:


diff --git a/JavaScriptCore/runtime/JSGlobalObject.cpp b/JavaScriptCore/runtime/JSGlobalObject.cpp
index a8fb7bf..11a06ce 100644
--- a/JavaScriptCore/runtime/JSGlobalObject.cpp
+++ b/JavaScriptCore/runtime/JSGlobalObject.cpp
@@ -163,15 +163,7 @@ void JSGlobalObject::putWithAttributes(ExecState* exec, const Identifier& proper

     if (symbolTablePutWithAttributes(propertyName, value, attributes))
         return;
-
-    JSValue valueBefore = getDirect(propertyName);
-    PutPropertySlot slot;
-    JSVariableObject::put(exec, propertyName, value, slot);
-    if (!valueBefore) {
-        JSValue valueAfter = getDirect(propertyName);
-        if (valueAfter)
-            JSObject::putWithAttributes(exec, propertyName, valueAfter, attributes);
-    }
+    JSObject::putWithAttributes(exec, propertyName, value, attributes);
 }

seems to fix the proposed testcase, and I don't get any regression in the jsc or layout tests. I must say that I don't really understand what the removed code is trying to achieve though, but the end result is that the value is introduced in the global object disregarding the attributes requested (first in the direct call to ::put, and after that in JSObject::putDirectInternal, when we find that the value was already inserted).

If this seems sensible I can do a layout test and put it up for review.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list