[Webkit-unassigned] [Bug 67255] [EFL][DRT] Normalize file:///tmp/LayoutTests in LayoutTestController::pathToLocalResource()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jun 7 12:09:15 PDT 2012


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





--- Comment #7 from Raphael Kubo da Costa (rakuco) - away until 2012-06-10 <rakuco at webkit.org>  2012-06-07 12:09:12 PST ---
(From update of attachment 145798)
View in context: https://bugs.webkit.org/attachment.cgi?id=145798&action=review

> Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp:181
> +// Convert a JSStringRef to a WTF::String - converted from a method of the same
> +// name in LayoutTestControllerMac.mm which returns a std::string
> +static inline String stringFromJSString(JSStringRef jsString)

Some nitpicking: have you tried operating on the UString returned by JSStringRef::ustring()? It has find() and substringSharingImpl(), so adding this method may be unnecessary.

> Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp:212
> +    if (requestedUrl.find("LayoutTests") != notFound) {
> +        // If the URL contains LayoutTests we need to remap that to
> +        // LOCAL_RESOURCE_ROOT which is the path of the LayoutTests directory
> +        // within the WebKit source tree.
> +        resourceRoot = getenv("LOCAL_RESOURCE_ROOT");
> +        String requestedRoot("/tmp/LayoutTests");
> +        size_t indexOfRootStart = requestedUrl.reverseFind(requestedRoot);
> +        indexOfSeparatorAfterRoot = indexOfRootStart + requestedRoot.length();
> +    } else if (requestedUrl.find("tmp") != notFound) {
> +        // If the URL is a child of /tmp we need to convert it to be a child
> +        // DUMPRENDERTREE_TEMP replace tmp with DUMPRENDERTREE_TEMP
> +        resourceRoot = getenv("DUMPRENDERTREE_TEMP");
> +        String requestedRoot("/tmp");
> +        size_t indexOfRootStart = requestedUrl.reverseFind(requestedRoot);
> +        indexOfSeparatorAfterRoot = indexOfRootStart + requestedRoot.length();
> +    }

The code to calculate the index of the separator seems to be duplicated in each case. What if you do something like
  if (requestedUrl.find("LayoutTests") != notFound) {
      requestedRoot = "/tmp/LayoutTests";
      resourceRoot = getenv("LOCAL_RESOURCE_ROOT");
  } else if (...) {
      requestedRoot = "/tmp";
      resourceRoot = getenv("DUMPRENDERTREE_TEMP");
  } else
      ASSERT_NOT_REACHED(); // via mac's LTC.mm

  // calculate separator index here

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