RESOLVED FIXED Bug 67255
[EFL][DRT] Normalize file:///tmp/LayoutTests in LayoutTestController::pathToLocalResource()
https://bugs.webkit.org/show_bug.cgi?id=67255
Summary [EFL][DRT] Normalize file:///tmp/LayoutTests in LayoutTestController::pathToL...
Jarred Nicholls
Reported 2011-08-30 20:26:34 PDT
EFL DRT should translate file:///tmp/LayoutTests paths into a local URL that's derived from the path of the DRT application exec.
Attachments
Patch (5.18 KB, patch)
2012-06-04 23:17 PDT, Joshua Lock (joshuagl)
no flags
Patch (5.18 KB, patch)
2012-06-05 08:00 PDT, Joshua Lock (joshuagl)
no flags
Patch (4.45 KB, patch)
2012-06-07 17:27 PDT, Joshua Lock (joshuagl)
no flags
Raphael Kubo da Costa (:rakuco)
Comment 1 2012-04-19 08:01:33 PDT
*** Bug 84336 has been marked as a duplicate of this bug. ***
Joshua Lock (joshuagl)
Comment 2 2012-06-04 23:17:32 PDT
Dominik Röttsches (drott)
Comment 3 2012-06-05 00:08:51 PDT
(In reply to comment #2) > Created an attachment (id=145699) [details] Looks good to me, thanks.
Gyuyoung Kim
Comment 4 2012-06-05 00:23:31 PDT
Comment on attachment 145699 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=145699&action=review > Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp:198 > + // If the url contains LayoutTests we need to remap that to %s/url/URL/g > Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp:206 > + // If the url is a child of /tmp we need to convert it to be a child ditto.
Joshua Lock (joshuagl)
Comment 5 2012-06-05 08:00:43 PDT
Gyuyoung Kim
Comment 6 2012-06-06 19:31:43 PDT
Comment on attachment 145798 [details] Patch Looks fine.
Raphael Kubo da Costa (:rakuco)
Comment 7 2012-06-07 12:09:12 PDT
Comment on attachment 145798 [details] Patch 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
Joshua Lock (joshuagl)
Comment 8 2012-06-07 14:46:51 PDT
Comment on attachment 145798 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=145798&action=review >> Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp:181 >> +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. I have not, I looked to other LayoutController* for inspiration. Will have a go with ustring() now, I'd much prefer not to add extra methods - thanks for the hint. >> Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp:212 >> + } > > 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 Much nicer, will do.
Joshua Lock (joshuagl)
Comment 9 2012-06-07 17:27:44 PDT
Joshua Lock (joshuagl)
Comment 10 2012-06-07 17:28:30 PDT
Comment on attachment 145798 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=145798&action=review >>> Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp:181 >>> +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. > > I have not, I looked to other LayoutController* for inspiration. Will have a go with ustring() now, I'd much prefer not to add extra methods - thanks for the hint. I played around some with UString but instead I've opted to avoid the extra method by following a pattern I noticed in other parts of LayoutTestControllerEfl.cpp and construct a WTF::String from the characters of the JSStringRef like: String requestedUrl(url->characters()).
Raphael Kubo da Costa (:rakuco)
Comment 11 2012-06-07 18:11:32 PDT
(In reply to comment #10) > I played around some with UString but instead I've opted to avoid the extra method by following a pattern I noticed in other parts of LayoutTestControllerEfl.cpp and construct a WTF::String from the characters of the JSStringRef like: String requestedUrl(url->characters()). Alright, it looks much better. Thank you!
WebKit Review Bot
Comment 12 2012-06-07 19:59:53 PDT
Comment on attachment 146425 [details] Patch Clearing flags on attachment: 146425 Committed r119788: <http://trac.webkit.org/changeset/119788>
WebKit Review Bot
Comment 13 2012-06-07 19:59:59 PDT
All reviewed patches have been landed. Closing bug.
Sudarsana Nagineni (babu)
Comment 14 2012-06-08 06:50:57 PDT
(In reply to comment #10) > I played around some with UString but instead I've opted to avoid the extra method by following a pattern I noticed in other parts of LayoutTestControllerEfl.cpp and construct a WTF::String from the characters of the JSStringRef like: String requestedUrl(url->characters()). The following tests started failing with this patch. It seems the problem is due to characters() not being null-terminated. http://build.webkit.org/builders/EFL%20Linux%2064-bit%20Debug/builds/952/steps/layout-test/logs/stdio fast/dom/frame-loading-via-document-write.html = TEXT http/tests/security/frame-loading-via-document-write.html = TEXT http/tests/security/local-JavaScript-from-remote.html = TEXT http/tests/security/local-iFrame-from-remote.html = TEXT
Sudarsana Nagineni (babu)
Comment 15 2012-06-08 09:06:50 PDT
(In reply to comment #14) > The following tests started failing with this patch. It seems the problem is due to characters() not being null-terminated. New bug created for this issue: https://bugs.webkit.org/show_bug.cgi?id=88661
Note You need to log in before you can comment on or make changes to this bug.