Example #1
0
JSString& JSString::operator=(const JSString& other) {
  JSStringRelease(instance_);
  instance_ = other.instance_;
  JSStringRetain(instance_);

  return *this;
}
JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
{
    GOwnPtr<char> urlCString(JSStringCopyUTF8CString(url));
    if (!g_str_has_prefix(urlCString.get(), "file:///tmp/LayoutTests/"))
        return JSStringRetain(url);

    const char* layoutTestsSuffix = urlCString.get() + strlen("file:///tmp/");
    GOwnPtr<char> testPath(g_build_filename(getTopLevelPath().data(), layoutTestsSuffix, NULL));
    GOwnPtr<char> testURI(g_filename_to_uri(testPath.get(), 0, 0));
    return JSStringCreateWithUTF8CString(testURI.get());
}
JSRetainPtr<JSStringRef> TestRunner::pathToLocalResource(JSStringRef url)
{
    size_t urlSize = JSStringGetMaximumUTF8CStringSize(url);
    GOwnPtr<gchar> urlString(static_cast<gchar*>(g_malloc(urlSize)));
    JSStringGetUTF8CString(url, urlString.get(), urlSize);

    if (!g_str_has_prefix(urlString.get(), "file:///tmp/LayoutTests/"))
        return JSStringRetain(url);

    const gchar* layoutTestsSuffix = urlString.get() + strlen("file:///tmp/");
    GOwnPtr<gchar> testPath(g_build_filename(WTR::topLevelPath().data(), layoutTestsSuffix, NULL));
    GOwnPtr<gchar> testURI(g_filename_to_uri(testPath.get(), 0, 0));
    return JSStringCreateWithUTF8CString(testURI.get());
}
Example #4
0
JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
{
    // Function introduced in r28690. This may need special-casing on Windows.
    return JSStringRetain(url); // Do nothing on Unix.
}
JSRetainPtr<JSStringRef> LayoutTestController::pathToLocalResource(JSStringRef url)
{
    return JSStringRetain(url); // TODO.
}
Example #6
0
JSString::JSString(const JSString& other) : instance_(other.instance_) {
  JSStringRetain(instance_);
}