Title: [172206] trunk/Tools
Revision
172206
Author
[email protected]
Date
2014-08-07 03:20:03 -0700 (Thu, 07 Aug 2014)

Log Message

[GTK] Test /webkit2/WebKitUserContentManager/injected-script fails
https://bugs.webkit.org/show_bug.cgi?id=135696

Reviewed by Sergio Villar Senin.

Don't assume the _javascript_ result is always a valid pointer. In case of _javascript_
exception (that happens when testing the script hasn't been injected) the _javascript_
result is NULL.

* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp:
(isScriptInjectedForURLAtPath):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (172205 => 172206)


--- trunk/Tools/ChangeLog	2014-08-07 08:14:26 UTC (rev 172205)
+++ trunk/Tools/ChangeLog	2014-08-07 10:20:03 UTC (rev 172206)
@@ -1,3 +1,17 @@
+2014-08-07  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Test /webkit2/WebKitUserContentManager/injected-script fails
+        https://bugs.webkit.org/show_bug.cgi?id=135696
+
+        Reviewed by Sergio Villar Senin.
+
+        Don't assume the _javascript_ result is always a valid pointer. In case of _javascript_
+        exception (that happens when testing the script hasn't been injected) the _javascript_
+        result is NULL.
+
+        * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp:
+        (isScriptInjectedForURLAtPath):
+
 2014-08-07  Csaba Osztrogonác  <[email protected]>
 
         [GTK] Disable IndexedDB

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp (172205 => 172206)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp	2014-08-07 08:14:26 UTC (rev 172205)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitUserContentManager.cpp	2014-08-07 10:20:03 UTC (rev 172206)
@@ -51,7 +51,7 @@
 static const char* kStyleSheetTestScript = "getComputedStyle(document.getElementById('styledElement'))['font-weight']";
 static const char* kStyleSheetTestScriptResult = "bold";
 static const char* kInjectedScript = "document.write('<div id=\"item\">Generated by a script</div>')";
-static const char* kScriptTestScript = "getElementById('item').innerText";
+static const char* kScriptTestScript = "document.getElementById('item').innerText";
 static const char* kScriptTestScriptResult = "Generated by a script";
 
 static void testWebViewNewWithUserContentManager(Test* test, gconstpointer)
@@ -85,12 +85,13 @@
     test->waitUntilLoadFinished();
 
     GUniqueOutPtr<GError> error;
-    WebKitJavascriptResult* _javascript_Result = test->runJavaScriptAndWaitUntilFinished(kScriptTestScript, &error.outPtr());
-    g_assert(_javascript_Result);
-    g_assert(!error.get());
+    if (WebKitJavascriptResult* _javascript_Result = test->runJavaScriptAndWaitUntilFinished(kScriptTestScript, &error.outPtr())) {
+        g_assert(!error.get());
 
-    GUniquePtr<char> resultString(WebViewTest::_javascript_ResultToCString(_javascript_Result));
-    return !g_strcmp0(resultString.get(), kScriptTestScriptResult);
+        GUniquePtr<char> resultString(WebViewTest::_javascript_ResultToCString(_javascript_Result));
+        return !g_strcmp0(resultString.get(), kScriptTestScriptResult);
+    }
+    return false;
 }
 
 static void fillURLListFromPaths(char** list, const char* path, ...)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to