[Webkit-unassigned] [Bug 42327] WebKitTestRunner needs to support layoutTestController.evaluateScriptInIsolatedWorld

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 20 08:22:30 PST 2011


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


Adam Roben (aroben) <aroben at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #79574|review?                     |review+
               Flag|                            |




--- Comment #4 from Adam Roben (aroben) <aroben at apple.com>  2011-01-20 08:22:30 PST ---
(From update of attachment 79574)
View in context: https://bugs.webkit.org/attachment.cgi?id=79574&action=review

You could try to touch some file in JSC in this patch to make the Qt bots rebuild. (It will help real people, too, not just the bots!)

> Source/WebKit2/WebProcess/WebPage/WebFrame.cpp:463
> +    if (!strcmp(globalObjectObj->classInfo()->className, "JSDOMWindowShell")) {

An early-return here would be nicer, I think.

> Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:533
> +        JSObjectSetProperty(context, window, JSRetainPtr<JSStringRef>(Adopt, JSStringCreateWithUTF8CString("__worldID")).get(), JSValueMakeNumber(context, LayoutTestController::worldIDForWorld(world)), kJSPropertyAttributeReadOnly, 0);

I think you can use the toJS helper function instead of calling JSStringCreateWithUTF8CString.

> Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:328
> +unsigned LayoutTestController::worldIDForWorld(WKBundleScriptWorldRef world)
> +{
> +    WorldMap::const_iterator end = worldMap().end();
> +    for (WorldMap::const_iterator it = worldMap().begin(); it != end; ++it) {
> +        if (it->second == world)
> +            return it->first;
> +    }
> +
> +    return 0;
> +}

Maybe someday we'll add a HashMap::findValue function that would do this for you.

> Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:336
> +    WKBundleScriptWorldRef world;
> +    if (!worldID)
> +        world = WKBundleScriptWorldCreateWorld();

Looks like you're leaking this newly-created world.

> Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:346
> +    WKBundleFrameRef frame = WKBundleFrameForJavaScriptContext(context);
> +    if (!frame)
> +        frame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());

DumpRenderTree only ever evaluates the script in the main frame. I guess this is an improvement, though it could lead to confusing differences in tests that try to evaluate script in a subframe.

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