Title: [200694] trunk
Revision
200694
Author
commit-qu...@webkit.org
Date
2016-05-11 11:33:31 -0700 (Wed, 11 May 2016)

Log Message

Improve error messages for accessing arguments.callee and similar getters in strict mode
https://bugs.webkit.org/show_bug.cgi?id=157545

Patch by Joseph Pecoraro <pecor...@apple.com> on 2016-05-11
Reviewed by Mark Lam.

Source/_javascript_Core:

* runtime/ClonedArguments.cpp:
(JSC::ClonedArguments::getOwnPropertySlot):
(JSC::ClonedArguments::materializeSpecials):
Provide better error GetterSetter in strict mode.

* runtime/JSFunction.cpp:
(JSC::getThrowTypeErrorGetterSetter):
(JSC::JSFunction::defineOwnProperty):
Provide better error GetterSetter in strict mode.

* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::throwTypeErrorGetterSetter):
(JSC::JSGlobalObject::throwTypeErrorCalleeAndCallerGetterSetter):
(JSC::JSGlobalObject::throwTypeErrorArgumentsAndCallerInStrictModeGetterSetter):
(JSC::JSGlobalObject::throwTypeErrorArgumentsAndCallerInClassContextGetterSetter):
(JSC::JSGlobalObject::throwTypeErrorArgumentsAndCallerGetterSetter): Deleted.
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncThrowTypeErrorCalleeAndCaller):
(JSC::globalFuncThrowTypeErrorArgumentsAndCallerInStrictMode):
(JSC::globalFuncThrowTypeErrorArgumentsAndCallerInClassContext):
(JSC::globalFuncThrowTypeErrorArgumentsAndCaller): Deleted.
* runtime/JSGlobalObjectFunctions.h:
Rename and expose new handles for new error getter setter native functions.

LayoutTests:

* js/basic-strict-mode-expected.txt:
* js/caller-property-expected.txt:
* js/script-tests/caller-property.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (200693 => 200694)


--- trunk/LayoutTests/ChangeLog	2016-05-11 18:13:04 UTC (rev 200693)
+++ trunk/LayoutTests/ChangeLog	2016-05-11 18:33:31 UTC (rev 200694)
@@ -1,3 +1,14 @@
+2016-05-11  Joseph Pecoraro  <pecor...@apple.com>
+
+        Improve error messages for accessing arguments.callee and similar getters in strict mode
+        https://bugs.webkit.org/show_bug.cgi?id=157545
+
+        Reviewed by Mark Lam.
+
+        * js/basic-strict-mode-expected.txt:
+        * js/caller-property-expected.txt:
+        * js/script-tests/caller-property.js:
+
 2016-05-11  Chris Dumez  <cdu...@apple.com>
 
         Unreviewed, rolling out r200686.

Modified: trunk/LayoutTests/js/basic-strict-mode-expected.txt (200693 => 200694)


--- trunk/LayoutTests/js/basic-strict-mode-expected.txt	2016-05-11 18:13:04 UTC (rev 200693)
+++ trunk/LayoutTests/js/basic-strict-mode-expected.txt	2016-05-11 18:33:31 UTC (rev 200694)
@@ -56,18 +56,18 @@
 PASS (function(){(function (){var a; function f() {'use strict'; delete a;} })()}) threw exception SyntaxError: Cannot delete unqualified property 'a' in strict mode..
 PASS (function (){'use strict'; with(1){};}) threw exception SyntaxError: 'with' statements are not valid in strict mode..
 PASS (function(){(function (){'use strict'; with(1){};})}) threw exception SyntaxError: 'with' statements are not valid in strict mode..
-PASS (function (){'use strict'; arguments.callee; })() threw exception TypeError: Type error.
-PASS (function (){'use strict'; arguments.caller; })() threw exception TypeError: Type error.
-PASS (function f(){'use strict'; f.arguments; })() threw exception TypeError: Type error.
-PASS (function f(){'use strict'; f.caller; })() threw exception TypeError: Type error.
-PASS (function f(){'use strict'; f.arguments=5; })() threw exception TypeError: Type error.
-PASS (function f(){'use strict'; f.caller=5; })() threw exception TypeError: Type error.
-PASS (function (arg){'use strict'; arguments.callee; })() threw exception TypeError: Type error.
-PASS (function (arg){'use strict'; arguments.caller; })() threw exception TypeError: Type error.
-PASS (function f(arg){'use strict'; f.arguments; })() threw exception TypeError: Type error.
-PASS (function f(arg){'use strict'; f.caller; })() threw exception TypeError: Type error.
-PASS (function f(arg){'use strict'; f.arguments=5; })() threw exception TypeError: Type error.
-PASS (function f(arg){'use strict'; f.caller=5; })() threw exception TypeError: Type error.
+PASS (function (){'use strict'; arguments.callee; })() threw exception TypeError: 'callee' and 'caller' cannot be accessed in strict mode..
+PASS (function (){'use strict'; arguments.caller; })() threw exception TypeError: 'callee' and 'caller' cannot be accessed in strict mode..
+PASS (function f(){'use strict'; f.arguments; })() threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
+PASS (function f(){'use strict'; f.caller; })() threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
+PASS (function f(){'use strict'; f.arguments=5; })() threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
+PASS (function f(){'use strict'; f.caller=5; })() threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
+PASS (function (arg){'use strict'; arguments.callee; })() threw exception TypeError: 'callee' and 'caller' cannot be accessed in strict mode..
+PASS (function (arg){'use strict'; arguments.caller; })() threw exception TypeError: 'callee' and 'caller' cannot be accessed in strict mode..
+PASS (function f(arg){'use strict'; f.arguments; })() threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
+PASS (function f(arg){'use strict'; f.caller; })() threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
+PASS (function f(arg){'use strict'; f.arguments=5; })() threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
+PASS (function f(arg){'use strict'; f.caller=5; })() threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
 PASS "caller" in function(){"use strict"} is true
 PASS (function(){"use strict";}).hasOwnProperty("caller") is true
 PASS "arguments" in function(){"use strict"} is true

Modified: trunk/LayoutTests/js/caller-property-expected.txt (200693 => 200694)


--- trunk/LayoutTests/js/caller-property-expected.txt	2016-05-11 18:13:04 UTC (rev 200693)
+++ trunk/LayoutTests/js/caller-property-expected.txt	2016-05-11 18:33:31 UTC (rev 200694)
@@ -7,25 +7,25 @@
 PASS childHasCallerWhenCalledWithoutParent is false
 PASS childHasCallerWhenCalledFromWithinParent is true
 PASS nonStrictCaller(nonStrictCallee) is nonStrictCaller
-PASS nonStrictCaller(strictCallee) threw exception TypeError: Type error.
+PASS nonStrictCaller(strictCallee) threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
 PASS strictCaller(nonStrictCallee) threw exception TypeError: Function.caller used to retrieve strict caller.
-PASS strictCaller(strictCallee) threw exception TypeError: Type error.
+PASS strictCaller(strictCallee) threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
 PASS strictTailCaller(nonStrictCallee) is null
-PASS strictTailCaller(strictCallee) threw exception TypeError: Type error.
+PASS strictTailCaller(strictCallee) threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
 PASS nonStrictCaller(boundNonStrictCallee) is nonStrictCaller
-PASS nonStrictCaller(boundStrictCallee) threw exception TypeError: Type error.
+PASS nonStrictCaller(boundStrictCallee) threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
 PASS strictCaller(boundNonStrictCallee) threw exception TypeError: Function.caller used to retrieve strict caller.
-PASS strictCaller(boundStrictCallee) threw exception TypeError: Type error.
+PASS strictCaller(boundStrictCallee) threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
 PASS strictTailCaller(boundNonStrictCallee) is null
-PASS strictTailCaller(boundStrictCallee) threw exception TypeError: Type error.
+PASS strictTailCaller(boundStrictCallee) threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
 PASS nonStrictGetter(nonStrictAccessor) is nonStrictGetter
 PASS nonStrictSetter(nonStrictAccessor) is true
-PASS nonStrictGetter(strictAccessor) threw exception TypeError: Type error.
-PASS nonStrictSetter(strictAccessor) threw exception TypeError: Type error.
+PASS nonStrictGetter(strictAccessor) threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
+PASS nonStrictSetter(strictAccessor) threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
 PASS strictGetter(nonStrictAccessor) threw exception TypeError: Function.caller used to retrieve strict caller.
 PASS strictSetter(nonStrictAccessor) threw exception TypeError: Function.caller used to retrieve strict caller.
-PASS strictGetter(strictAccessor) threw exception TypeError: Type error.
-PASS strictSetter(strictAccessor) threw exception TypeError: Type error.
+PASS strictGetter(strictAccessor) threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
+PASS strictSetter(strictAccessor) threw exception TypeError: 'caller' and 'arguments' cannot be accessed in strict mode..
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/js/script-tests/caller-property.js (200693 => 200694)


--- trunk/LayoutTests/js/script-tests/caller-property.js	2016-05-11 18:13:04 UTC (rev 200693)
+++ trunk/LayoutTests/js/script-tests/caller-property.js	2016-05-11 18:33:31 UTC (rev 200694)
@@ -27,21 +27,21 @@
 function strictCaller(x) { "use strict"; var result = x(); return result; }
 function strictTailCaller(x) { "use strict"; return x(); }
 shouldBe("nonStrictCaller(nonStrictCallee)", "nonStrictCaller");
-shouldThrow("nonStrictCaller(strictCallee)", '"TypeError: Type error"');
+shouldThrow("nonStrictCaller(strictCallee)");
 shouldThrow("strictCaller(nonStrictCallee)", '"TypeError: Function.caller used to retrieve strict caller"');
-shouldThrow("strictCaller(strictCallee)", '"TypeError: Type error"');
+shouldThrow("strictCaller(strictCallee)");
 shouldBe("strictTailCaller(nonStrictCallee)", "null");
-shouldThrow("strictTailCaller(strictCallee)", '"TypeError: Type error"');
+shouldThrow("strictTailCaller(strictCallee)");
 
 // .caller within a bound function reaches the caller, ignoring the binding.
 var boundNonStrictCallee = nonStrictCallee.bind();
 var boundStrictCallee = strictCallee.bind();
 shouldBe("nonStrictCaller(boundNonStrictCallee)", "nonStrictCaller");
-shouldThrow("nonStrictCaller(boundStrictCallee)", '"TypeError: Type error"');
+shouldThrow("nonStrictCaller(boundStrictCallee)");
 shouldThrow("strictCaller(boundNonStrictCallee)", '"TypeError: Function.caller used to retrieve strict caller"');
-shouldThrow("strictCaller(boundStrictCallee)", '"TypeError: Type error"');
+shouldThrow("strictCaller(boundStrictCallee)");
 shouldBe("strictTailCaller(boundNonStrictCallee)", "null");
-shouldThrow("strictTailCaller(boundStrictCallee)", '"TypeError: Type error"');
+shouldThrow("strictTailCaller(boundStrictCallee)");
 
 // Check that .caller works (or throws) as expected, over an accessor call.
 function getFooGetter(x) { return Object.getOwnPropertyDescriptor(x, 'foo').get; }
@@ -60,9 +60,9 @@
 function strictSetter(x) { "use strict"; x.foo = nonStrictSetter; return true; }
 shouldBe("nonStrictGetter(nonStrictAccessor)", "nonStrictGetter");
 shouldBeTrue("nonStrictSetter(nonStrictAccessor)");
-shouldThrow("nonStrictGetter(strictAccessor)", '"TypeError: Type error"');
-shouldThrow("nonStrictSetter(strictAccessor)", '"TypeError: Type error"');
+shouldThrow("nonStrictGetter(strictAccessor)");
+shouldThrow("nonStrictSetter(strictAccessor)");
 shouldThrow("strictGetter(nonStrictAccessor)", '"TypeError: Function.caller used to retrieve strict caller"');
 shouldThrow("strictSetter(nonStrictAccessor)", '"TypeError: Function.caller used to retrieve strict caller"');
-shouldThrow("strictGetter(strictAccessor)", '"TypeError: Type error"');
-shouldThrow("strictSetter(strictAccessor)", '"TypeError: Type error"');
+shouldThrow("strictGetter(strictAccessor)");
+shouldThrow("strictSetter(strictAccessor)");

Modified: trunk/Source/_javascript_Core/ChangeLog (200693 => 200694)


--- trunk/Source/_javascript_Core/ChangeLog	2016-05-11 18:13:04 UTC (rev 200693)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-05-11 18:33:31 UTC (rev 200694)
@@ -1,3 +1,37 @@
+2016-05-11  Joseph Pecoraro  <pecor...@apple.com>
+
+        Improve error messages for accessing arguments.callee and similar getters in strict mode
+        https://bugs.webkit.org/show_bug.cgi?id=157545
+
+        Reviewed by Mark Lam.
+
+        * runtime/ClonedArguments.cpp:
+        (JSC::ClonedArguments::getOwnPropertySlot):
+        (JSC::ClonedArguments::materializeSpecials):
+        Provide better error GetterSetter in strict mode.
+
+        * runtime/JSFunction.cpp:
+        (JSC::getThrowTypeErrorGetterSetter):
+        (JSC::JSFunction::defineOwnProperty):
+        Provide better error GetterSetter in strict mode.
+
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init):
+        (JSC::JSGlobalObject::visitChildren):
+        * runtime/JSGlobalObject.h:
+        (JSC::JSGlobalObject::throwTypeErrorGetterSetter):
+        (JSC::JSGlobalObject::throwTypeErrorCalleeAndCallerGetterSetter):
+        (JSC::JSGlobalObject::throwTypeErrorArgumentsAndCallerInStrictModeGetterSetter):
+        (JSC::JSGlobalObject::throwTypeErrorArgumentsAndCallerInClassContextGetterSetter):
+        (JSC::JSGlobalObject::throwTypeErrorArgumentsAndCallerGetterSetter): Deleted.
+        * runtime/JSGlobalObjectFunctions.cpp:
+        (JSC::globalFuncThrowTypeErrorCalleeAndCaller):
+        (JSC::globalFuncThrowTypeErrorArgumentsAndCallerInStrictMode):
+        (JSC::globalFuncThrowTypeErrorArgumentsAndCallerInClassContext):
+        (JSC::globalFuncThrowTypeErrorArgumentsAndCaller): Deleted.
+        * runtime/JSGlobalObjectFunctions.h:
+        Rename and expose new handles for new error getter setter native functions.
+
 2016-05-11  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r200481.

Modified: trunk/Source/_javascript_Core/runtime/ClonedArguments.cpp (200693 => 200694)


--- trunk/Source/_javascript_Core/runtime/ClonedArguments.cpp	2016-05-11 18:13:04 UTC (rev 200693)
+++ trunk/Source/_javascript_Core/runtime/ClonedArguments.cpp	2016-05-11 18:33:31 UTC (rev 200694)
@@ -158,11 +158,11 @@
 
         if (isStrictMode) {
             if (ident == vm.propertyNames->callee) {
-                slot.setGetterSlot(thisObject, DontDelete | DontEnum | Accessor, thisObject->globalObject()->throwTypeErrorGetterSetter());
+                slot.setGetterSlot(thisObject, DontDelete | DontEnum | Accessor, thisObject->globalObject()->throwTypeErrorCalleeAndCallerGetterSetter());
                 return true;
             }
             if (ident == vm.propertyNames->caller) {
-                slot.setGetterSlot(thisObject, DontDelete | DontEnum | Accessor, thisObject->globalObject()->throwTypeErrorGetterSetter());
+                slot.setGetterSlot(thisObject, DontDelete | DontEnum | Accessor, thisObject->globalObject()->throwTypeErrorCalleeAndCallerGetterSetter());
                 return true;
             }
 
@@ -238,8 +238,8 @@
     bool isStrictMode = executable->isStrictMode();
     
     if (isStrictMode) {
-        putDirectAccessor(exec, vm.propertyNames->callee, globalObject()->throwTypeErrorGetterSetter(), DontDelete | DontEnum | Accessor);
-        putDirectAccessor(exec, vm.propertyNames->caller, globalObject()->throwTypeErrorGetterSetter(), DontDelete | DontEnum | Accessor);
+        putDirectAccessor(exec, vm.propertyNames->callee, globalObject()->throwTypeErrorCalleeAndCallerGetterSetter(), DontDelete | DontEnum | Accessor);
+        putDirectAccessor(exec, vm.propertyNames->caller, globalObject()->throwTypeErrorCalleeAndCallerGetterSetter(), DontDelete | DontEnum | Accessor);
     } else
         putDirect(vm, vm.propertyNames->callee, JSValue(m_callee.get()));
 

Modified: trunk/Source/_javascript_Core/runtime/JSFunction.cpp (200693 => 200694)


--- trunk/Source/_javascript_Core/runtime/JSFunction.cpp	2016-05-11 18:13:04 UTC (rev 200693)
+++ trunk/Source/_javascript_Core/runtime/JSFunction.cpp	2016-05-11 18:33:31 UTC (rev 200694)
@@ -322,8 +322,8 @@
 static GetterSetter* getThrowTypeErrorGetterSetter(JSFunction* function)
 {
     return function->jsExecutable()->isClassConstructorFunction() || function->jsExecutable()->parseMode() == SourceParseMode::MethodMode
-        ? function->globalObject()->throwTypeErrorArgumentsAndCallerGetterSetter()
-        : function->globalObject()->throwTypeErrorGetterSetter();
+        ? function->globalObject()->throwTypeErrorArgumentsAndCallerInClassContextGetterSetter()
+        : function->globalObject()->throwTypeErrorArgumentsAndCallerInStrictModeGetterSetter();
 }
 
 EncodedJSValue JSFunction::callerGetter(ExecState* exec, EncodedJSValue thisValue, PropertyName)
@@ -499,7 +499,7 @@
         if (thisObject->jsExecutable()->isStrictMode()) {
             PropertySlot slot(thisObject, PropertySlot::InternalMethodType::VMInquiry);
             if (!Base::getOwnPropertySlot(thisObject, exec, propertyName, slot))
-                thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(), DontDelete | DontEnum | Accessor);
+                thisObject->putDirectAccessor(exec, propertyName, getThrowTypeErrorGetterSetter(thisObject), DontDelete | DontEnum | Accessor);
             return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException);
         }
         valueCheck = !descriptor.value() || sameValue(exec, descriptor.value(), retrieveArguments(exec, thisObject));
@@ -507,7 +507,7 @@
         if (thisObject->jsExecutable()->isStrictMode()) {
             PropertySlot slot(thisObject, PropertySlot::InternalMethodType::VMInquiry);
             if (!Base::getOwnPropertySlot(thisObject, exec, propertyName, slot))
-                thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(), DontDelete | DontEnum | Accessor);
+                thisObject->putDirectAccessor(exec, propertyName, getThrowTypeErrorGetterSetter(thisObject), DontDelete | DontEnum | Accessor);
             return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException);
         }
         valueCheck = !descriptor.value() || sameValue(exec, descriptor.value(), retrieveCallerFunction(exec, thisObject));

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (200693 => 200694)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2016-05-11 18:13:04 UTC (rev 200693)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2016-05-11 18:33:31 UTC (rev 200694)
@@ -387,14 +387,30 @@
             getterSetter->setSetter(init.vm, init.owner, thrower);
             init.set(getterSetter);
         });
-    m_throwTypeErrorArgumentsAndCallerGetterSetter.initLater(
+    m_throwTypeErrorCalleeAndCallerGetterSetter.initLater(
         [] (const Initializer<GetterSetter>& init) {
-            JSFunction* thrower = JSFunction::create(init.vm, init.owner, 0, String(), globalFuncThrowTypeErrorArgumentsAndCaller);
+            JSFunction* thrower = JSFunction::create(init.vm, init.owner, 0, String(), globalFuncThrowTypeErrorCalleeAndCaller);
             GetterSetter* getterSetter = GetterSetter::create(init.vm, init.owner);
             getterSetter->setGetter(init.vm, init.owner, thrower);
             getterSetter->setSetter(init.vm, init.owner, thrower);
             init.set(getterSetter);
         });
+    m_throwTypeErrorArgumentsAndCallerInStrictModeGetterSetter.initLater(
+        [] (const Initializer<GetterSetter>& init) {
+            JSFunction* thrower = JSFunction::create(init.vm, init.owner, 0, String(), globalFuncThrowTypeErrorArgumentsAndCallerInStrictMode);
+            GetterSetter* getterSetter = GetterSetter::create(init.vm, init.owner);
+            getterSetter->setGetter(init.vm, init.owner, thrower);
+            getterSetter->setSetter(init.vm, init.owner, thrower);
+            init.set(getterSetter);
+        });
+    m_throwTypeErrorArgumentsAndCallerInClassContextGetterSetter.initLater(
+        [] (const Initializer<GetterSetter>& init) {
+            JSFunction* thrower = JSFunction::create(init.vm, init.owner, 0, String(), globalFuncThrowTypeErrorArgumentsAndCallerInClassContext);
+            GetterSetter* getterSetter = GetterSetter::create(init.vm, init.owner);
+            getterSetter->setGetter(init.vm, init.owner, thrower);
+            getterSetter->setSetter(init.vm, init.owner, thrower);
+            init.set(getterSetter);
+        });
     m_nullGetterFunction.set(vm, this, NullGetterFunction::create(vm, NullGetterFunction::createStructure(vm, this, m_functionPrototype.get())));
     m_nullSetterFunction.set(vm, this, NullSetterFunction::create(vm, NullSetterFunction::createStructure(vm, this, m_functionPrototype.get())));
     m_objectPrototype.set(vm, this, ObjectPrototype::create(vm, this, ObjectPrototype::createStructure(vm, this, jsNull())));
@@ -1072,7 +1088,9 @@
     visitor.append(&thisObject->m_newPromiseCapabilityFunction);
     visitor.append(&thisObject->m_functionProtoHasInstanceSymbolFunction);
     thisObject->m_throwTypeErrorGetterSetter.visit(visitor);
-    thisObject->m_throwTypeErrorArgumentsAndCallerGetterSetter.visit(visitor);
+    thisObject->m_throwTypeErrorCalleeAndCallerGetterSetter.visit(visitor);
+    thisObject->m_throwTypeErrorArgumentsAndCallerInStrictModeGetterSetter.visit(visitor);
+    thisObject->m_throwTypeErrorArgumentsAndCallerInClassContextGetterSetter.visit(visitor);
     visitor.append(&thisObject->m_moduleLoader);
 
     visitor.append(&thisObject->m_objectPrototype);

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (200693 => 200694)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2016-05-11 18:13:04 UTC (rev 200693)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2016-05-11 18:33:31 UTC (rev 200694)
@@ -246,12 +246,14 @@
     LazyProperty<JSGlobalObject, JSFunction> m_initializePromiseFunction;
     WriteBarrier<JSFunction> m_newPromiseCapabilityFunction;
     WriteBarrier<JSFunction> m_functionProtoHasInstanceSymbolFunction;
-    LazyProperty<JSGlobalObject, GetterSetter> m_throwTypeErrorGetterSetter;
     WriteBarrier<JSObject> m_regExpProtoExec;
     WriteBarrier<JSObject> m_regExpProtoSymbolReplace;
     WriteBarrier<JSObject> m_regExpProtoGlobalGetter;
     WriteBarrier<JSObject> m_regExpProtoUnicodeGetter;
-    LazyProperty<JSGlobalObject, GetterSetter> m_throwTypeErrorArgumentsAndCallerGetterSetter;
+    LazyProperty<JSGlobalObject, GetterSetter> m_throwTypeErrorGetterSetter;
+    LazyProperty<JSGlobalObject, GetterSetter> m_throwTypeErrorCalleeAndCallerGetterSetter;
+    LazyProperty<JSGlobalObject, GetterSetter> m_throwTypeErrorArgumentsAndCallerInStrictModeGetterSetter;
+    LazyProperty<JSGlobalObject, GetterSetter> m_throwTypeErrorArgumentsAndCallerInClassContextGetterSetter;
 
     WriteBarrier<ModuleLoaderObject> m_moduleLoader;
 
@@ -493,15 +495,11 @@
     JSObject* regExpProtoSymbolReplaceFunction() const { return m_regExpProtoSymbolReplace.get(); }
     JSObject* regExpProtoGlobalGetter() const { return m_regExpProtoGlobalGetter.get(); }
     JSObject* regExpProtoUnicodeGetter() const { return m_regExpProtoUnicodeGetter.get(); }
-    GetterSetter* throwTypeErrorGetterSetter()
-    {
-        return m_throwTypeErrorGetterSetter.get(this);
-    }
 
-    GetterSetter* throwTypeErrorArgumentsAndCallerGetterSetter()
-    {
-        return m_throwTypeErrorArgumentsAndCallerGetterSetter.get(this);
-    }
+    GetterSetter* throwTypeErrorGetterSetter() { return m_throwTypeErrorGetterSetter.get(this); }
+    GetterSetter* throwTypeErrorCalleeAndCallerGetterSetter() { return m_throwTypeErrorCalleeAndCallerGetterSetter.get(this); }
+    GetterSetter* throwTypeErrorArgumentsAndCallerInStrictModeGetterSetter() { return m_throwTypeErrorArgumentsAndCallerInStrictModeGetterSetter.get(this); }
+    GetterSetter* throwTypeErrorArgumentsAndCallerInClassContextGetterSetter() { return m_throwTypeErrorArgumentsAndCallerInClassContextGetterSetter.get(this); }
     
     ModuleLoaderObject* moduleLoader() const { return m_moduleLoader.get(); }
 

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp (200693 => 200694)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp	2016-05-11 18:13:04 UTC (rev 200693)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp	2016-05-11 18:33:31 UTC (rev 200694)
@@ -781,9 +781,19 @@
 {
     return throwVMTypeError(exec);
 }
-    
-EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeErrorArgumentsAndCaller(ExecState* exec)
+
+EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeErrorCalleeAndCaller(ExecState* exec)
 {
+    return throwVMTypeError(exec, "'callee' and 'caller' cannot be accessed in strict mode.");
+}
+
+EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeErrorArgumentsAndCallerInStrictMode(ExecState* exec)
+{
+    return throwVMTypeError(exec, "'caller' and 'arguments' cannot be accessed in strict mode.");
+}
+
+EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeErrorArgumentsAndCallerInClassContext(ExecState* exec)
+{
     return throwVMTypeError(exec, "'caller' and 'arguments' cannot be accessed in class context.");
 }
 

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h (200693 => 200694)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h	2016-05-11 18:13:04 UTC (rev 200693)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.h	2016-05-11 18:33:31 UTC (rev 200694)
@@ -49,7 +49,9 @@
 EncodedJSValue JSC_HOST_CALL globalFuncEscape(ExecState*);
 EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState*);
 EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeError(ExecState*);
-EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeErrorArgumentsAndCaller(ExecState*);
+EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeErrorCalleeAndCaller(ExecState*);
+EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeErrorArgumentsAndCallerInStrictMode(ExecState*);
+EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeErrorArgumentsAndCallerInClassContext(ExecState*);
 EncodedJSValue JSC_HOST_CALL globalFuncProtoGetter(ExecState*);
 EncodedJSValue JSC_HOST_CALL globalFuncProtoSetter(ExecState*);
 EncodedJSValue JSC_HOST_CALL globalFuncBuiltinLog(ExecState*);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to