[Webkit-unassigned] [Bug 63583] Web Inspector fails to display source for eval with syntax error

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jun 28 20:55:02 PDT 2011


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


Geoffrey Garen <ggaren at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #99004|review?                     |review-
               Flag|                            |




--- Comment #2 from Geoffrey Garen <ggaren at apple.com>  2011-06-28 20:55:02 PST ---
(From update of attachment 99004)
View in context: https://bugs.webkit.org/attachment.cgi?id=99004&action=review

r- because I think there's a better way to write this test.

> Source/JavaScriptCore/API/tests/testapi.c:1352
> +    exception = NULL;
> +    functionBody = JSStringCreateWithUTF8CString("\neval(a[0]]);");
> +    line = JSStringCreateWithUTF8CString("line");
> +    ASSERT(!JSObjectMakeFunction(context, NULL, 0, NULL, functionBody, NULL, 1, &exception));
> +    ASSERT(JSValueIsObject(context, exception));
> +    v = JSObjectGetProperty(context, JSValueToObject(context, exception, NULL), line, NULL);
> +    assertEqualsAsNumber(v, 2);
> +    JSStringRelease(functionBody);
> +    JSStringRelease(line);

It's better to write this kind of test as a layout test. Layout tests have better reporting. Is there something preventing you from using a layout test in this case?

> Source/JavaScriptCore/parser/Parser.h:68
> +        bool isEvalNode(EvalNode*) { return true; }
> +        bool isEvalNode(ScopeNode*) { return false; }

I know you didn't write the original version of this code, but for future reference, a template function is a clearer way to achieve this goal:

// Declare:
template <typename T> inline bool isEvalNode() { return false; }
template <> inline bool isEvalNode<EvalNode>() { return true; }

// Call:
if (isEvalNode<ParsedNode>()) { ... }

-- 
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