+2006-10-31 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Beth.
+
+ Fixed http://bugs.webkit.org/show_bug.cgi?id=11477
+ REGRESSION: GMail crashes in KJS::FunctionImp::callerGetter
+
+ * kjs/function.cpp:
+ (KJS::FunctionImp::argumentsGetter): Removed unnecessary braces.
+ (KJS::FunctionImp::callerGetter): More logical NULL checking.
+
2006-10-31 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff.
FunctionImp* thisObj = static_cast<FunctionImp*>(slot.slotBase());
Context* context = exec->m_context;
while (context) {
- if (context->function() == thisObj) {
+ if (context->function() == thisObj)
return static_cast<ActivationImp*>(context->activationObject())->get(exec, propertyName);
- }
context = context->callingContext();
}
return jsNull();
JSValue* FunctionImp::callerGetter(ExecState* exec, JSObject*, const Identifier&, const PropertySlot& slot)
{
- FunctionImp* thisObj = static_cast<FunctionImp* >(slot.slotBase());
+ FunctionImp* thisObj = static_cast<FunctionImp*>(slot.slotBase());
Context* context = exec->m_context;
while (context) {
- if (context->function() == thisObj)
- return (context->callingContext()->function()) ? context->callingContext()->function() : jsNull();
-
+ if (context->function() == thisObj)
+ break;
context = context->callingContext();
}
- return jsNull();
+
+ if (!context)
+ return jsNull();
+
+ Context* callingContext = context->callingContext();
+ if (!callingContext)
+ return jsNull();
+
+ FunctionImp* callingFunction = callingContext->function();
+ if (!callingFunction)
+ return jsNull();
+
+ return callingFunction;
}
JSValue* FunctionImp::lengthGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot& slot)
+2006-10-31 Geoffrey Garen <ggaren@apple.com>
+
+ Added test for accessing the 'caller' property from inside an event
+ listener.
+
+ * fast/events/caller-access-from-event-listener-expected.txt: Added.
+ * fast/events/caller-access-from-event-listener.html: Added.
+
2006-10-31 Geoffrey Garen <ggaren@apple.com>
Added layout test for copying password field.
--- /dev/null
+<p>This test verifies that WebKit doesn't crash when accessing the 'caller' property
+from inside an event listener.</p>
+<hr>
+<pre>PASS: WebKit didn't crash.</pre>
+<script src="../js/resources/js-test-pre.js"></script>
+<script>
+function crash() {
+ eval('crash.caller');
+}
+
+window.onload = crash;
+</script>