Title: [110760] trunk
Revision
110760
Author
[email protected]
Date
2012-03-14 14:56:46 -0700 (Wed, 14 Mar 2012)

Log Message

[JSC] Web Inspector: CRASH running $0, $1, etc before they are set
https://bugs.webkit.org/show_bug.cgi?id=81082

Source/WebCore:

Don't return an invalid JSValue. Check if the ScriptValue
has no value and return undefined in that case.

Patch by Joseph Pecoraro <[email protected]> on 2012-03-14
Reviewed by Pavel Feldman.

Updated test: inspector/console/command-line-api.html

* bindings/js/JSInjectedScriptHostCustom.cpp:
(WebCore::JSInjectedScriptHost::inspectedObject):

LayoutTests:

Test for an undefined inspectedObject.

Patch by Joseph Pecoraro <[email protected]> on 2012-03-14
Reviewed by Pavel Feldman.

* inspector/console/command-line-api-expected.txt:
* inspector/console/command-line-api.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (110759 => 110760)


--- trunk/LayoutTests/ChangeLog	2012-03-14 21:43:20 UTC (rev 110759)
+++ trunk/LayoutTests/ChangeLog	2012-03-14 21:56:46 UTC (rev 110760)
@@ -1,3 +1,15 @@
+2012-03-14  Joseph Pecoraro  <[email protected]>
+
+        [JSC] Web Inspector: CRASH running $0, $1, etc before they are set
+        https://bugs.webkit.org/show_bug.cgi?id=81082
+
+        Test for an undefined inspectedObject.
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/console/command-line-api-expected.txt:
+        * inspector/console/command-line-api.html:
+
 2012-03-14  Adrienne Walker  <[email protected]>
 
         [chromium] Unreviewed, mark two compositing tests as passing.

Modified: trunk/LayoutTests/inspector/console/command-line-api-expected.txt (110759 => 110760)


--- trunk/LayoutTests/inspector/console/command-line-api-expected.txt	2012-03-14 21:43:20 UTC (rev 110759)
+++ trunk/LayoutTests/inspector/console/command-line-api-expected.txt	2012-03-14 21:56:46 UTC (rev 110760)
@@ -1,6 +1,7 @@
 Tests that command line api works.
 
 $0.toString() = "[object HTMLParagraphElement]"
+$3 = undefined
 keys([3,4]).toString() = "0,1"
 values([3,4]).toString() = "3,4"
 $('foo').toString() = "[object HTMLParagraphElement]"

Modified: trunk/LayoutTests/inspector/console/command-line-api.html (110759 => 110760)


--- trunk/LayoutTests/inspector/console/command-line-api.html	2012-03-14 21:43:20 UTC (rev 110759)
+++ trunk/LayoutTests/inspector/console/command-line-api.html	2012-03-14 21:56:46 UTC (rev 110760)
@@ -8,6 +8,7 @@
 {
     var expressions = [
         "$0.toString()",
+        "$3",
         "keys([3,4]).toString()",
         "values([3,4]).toString()",
         "$('foo').toString()",

Modified: trunk/Source/WebCore/ChangeLog (110759 => 110760)


--- trunk/Source/WebCore/ChangeLog	2012-03-14 21:43:20 UTC (rev 110759)
+++ trunk/Source/WebCore/ChangeLog	2012-03-14 21:56:46 UTC (rev 110760)
@@ -1,3 +1,18 @@
+2012-03-14  Joseph Pecoraro  <[email protected]>
+
+        [JSC] Web Inspector: CRASH running $0, $1, etc before they are set
+        https://bugs.webkit.org/show_bug.cgi?id=81082
+
+        Don't return an invalid JSValue. Check if the ScriptValue
+        has no value and return undefined in that case.
+
+        Reviewed by Pavel Feldman.
+
+        Updated test: inspector/console/command-line-api.html
+
+        * bindings/js/JSInjectedScriptHostCustom.cpp:
+        (WebCore::JSInjectedScriptHost::inspectedObject):
+
 2012-03-14  James Robinson  <[email protected]>
 
         [chromium] Remove canRecoverFromContextLoss attribute, it's unused

Modified: trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp (110759 => 110760)


--- trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp	2012-03-14 21:43:20 UTC (rev 110759)
+++ trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp	2012-03-14 21:56:46 UTC (rev 110760)
@@ -91,7 +91,11 @@
         return jsUndefined();
 
     JSLock lock(SilenceAssertionsOnly);
-    return object->get(exec).jsValue();
+    ScriptValue scriptValue = object->get(exec);
+    if (scriptValue.hasNoValue())
+        return jsUndefined();
+
+    return scriptValue.jsValue();
 }
 
 JSValue JSInjectedScriptHost::internalConstructorName(ExecState* exec)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to