<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[28978] trunk/WebKit/gtk</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/28978">28978</a></dd>
<dt>Author</dt> <dd>alp@webkit.org</dd>
<dt>Date</dt> <dd>2007-12-24 22:00:20 -0800 (Mon, 24 Dec 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>2007-12-24  Christian Dywan  &lt;christian@twotoasts.de&gt;

        Reviewed by Alp Toker.

        http://bugs.webkit.org/attachment.cgi?id=18099
        There are no NULL checks for strings in public api

        Add missing NULL checks for string parameters.

        Provide sensible defaults when NULL is passed for the optional
        parameters in webkit_web_view_load_string(). UTF-8 is the default
        encoding used by GLib and text/html is a reasonable default content
        type.

        * WebView/webkitnetworkrequest.cpp:
        * WebView/webkitwebview.cpp:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebKitgtkChangeLog">trunk/WebKit/gtk/ChangeLog</a></li>
<li><a href="#trunkWebKitgtkWebViewwebkitnetworkrequestcpp">trunk/WebKit/gtk/WebView/webkitnetworkrequest.cpp</a></li>
<li><a href="#trunkWebKitgtkWebViewwebkitwebviewcpp">trunk/WebKit/gtk/WebView/webkitwebview.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebKitgtkChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/gtk/ChangeLog (28977 => 28978)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/gtk/ChangeLog        2007-12-25 01:05:45 UTC (rev 28977)
+++ trunk/WebKit/gtk/ChangeLog        2007-12-25 06:00:20 UTC (rev 28978)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2007-12-24  Christian Dywan  &lt;christian@twotoasts.de&gt;
+
+        Reviewed by Alp Toker.
+
+        http://bugs.webkit.org/attachment.cgi?id=18099
+        There are no NULL checks for strings in public api
+
+        Add missing NULL checks for string parameters.
+
+        Provide sensible defaults when NULL is passed for the optional
+        parameters in webkit_web_view_load_string(). UTF-8 is the default
+        encoding used by GLib and text/html is a reasonable default content
+        type.
+
+        * WebView/webkitnetworkrequest.cpp:
+        * WebView/webkitwebview.cpp:
+
</ins><span class="cx"> 2007-12-22  Xan Lopez  &lt;xan@gnome.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Alp Toker.
</span></span></pre></div>
<a id="trunkWebKitgtkWebViewwebkitnetworkrequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/gtk/WebView/webkitnetworkrequest.cpp (28977 => 28978)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/gtk/WebView/webkitnetworkrequest.cpp        2007-12-25 01:05:45 UTC (rev 28977)
+++ trunk/WebKit/gtk/WebView/webkitnetworkrequest.cpp        2007-12-25 06:00:20 UTC (rev 28978)
</span><span class="lines">@@ -51,6 +51,8 @@
</span><span class="cx"> 
</span><span class="cx"> WebKitNetworkRequest* webkit_network_request_new(const gchar* uri)
</span><span class="cx"> {
</span><ins>+    g_return_val_if_fail(uri, NULL);
+
</ins><span class="cx">     WebKitNetworkRequest* request = WEBKIT_NETWORK_REQUEST(g_object_new(WEBKIT_TYPE_NETWORK_REQUEST, NULL));
</span><span class="cx">     WebKitNetworkRequestPrivate* requestPrivate = WEBKIT_NETWORK_REQUEST_GET_PRIVATE(request);
</span><span class="cx"> 
</span><span class="lines">@@ -61,11 +63,10 @@
</span><span class="cx"> 
</span><span class="cx"> void webkit_network_request_set_uri(WebKitNetworkRequest* request, const gchar* uri)
</span><span class="cx"> {
</span><del>-    WebKitNetworkRequestPrivate* requestPrivate;
-
</del><span class="cx">     g_return_if_fail(WEBKIT_IS_NETWORK_REQUEST(request));
</span><ins>+    g_return_if_fail(uri);
</ins><span class="cx"> 
</span><del>-    requestPrivate = WEBKIT_NETWORK_REQUEST_GET_PRIVATE(request);
</del><ins>+    WebKitNetworkRequestPrivate* requestPrivate = WEBKIT_NETWORK_REQUEST_GET_PRIVATE(request);
</ins><span class="cx"> 
</span><span class="cx">     g_free(requestPrivate-&gt;uri);
</span><span class="cx">     requestPrivate-&gt;uri = g_strdup(uri);
</span><span class="lines">@@ -73,11 +74,9 @@
</span><span class="cx"> 
</span><span class="cx"> const gchar* webkit_network_request_get_uri(WebKitNetworkRequest* request)
</span><span class="cx"> {
</span><del>-    WebKitNetworkRequestPrivate* requestPrivate;
-
</del><span class="cx">     g_return_val_if_fail(WEBKIT_IS_NETWORK_REQUEST(request), NULL);
</span><span class="cx"> 
</span><del>-    requestPrivate = WEBKIT_NETWORK_REQUEST_GET_PRIVATE(request);
</del><ins>+    WebKitNetworkRequestPrivate* requestPrivate = WEBKIT_NETWORK_REQUEST_GET_PRIVATE(request);
</ins><span class="cx"> 
</span><span class="cx">     return requestPrivate-&gt;uri;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkWebKitgtkWebViewwebkitwebviewcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/gtk/WebView/webkitwebview.cpp (28977 => 28978)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/gtk/WebView/webkitwebview.cpp        2007-12-25 01:05:45 UTC (rev 28977)
+++ trunk/WebKit/gtk/WebView/webkitwebview.cpp        2007-12-25 06:00:20 UTC (rev 28978)
</span><span class="lines">@@ -963,6 +963,7 @@
</span><span class="cx"> void webkit_web_view_open(WebKitWebView* webView, const gchar* uri)
</span><span class="cx"> {
</span><span class="cx">     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
</span><ins>+    g_return_if_fail(uri);
</ins><span class="cx"> 
</span><span class="cx">     Frame* frame = core(webkit_web_view_get_main_frame(webView));
</span><span class="cx">     DeprecatedString string = DeprecatedString::fromUtf8(uri);
</span><span class="lines">@@ -980,21 +981,23 @@
</span><span class="cx"> void webkit_web_view_load_string(WebKitWebView* webView, const gchar* content, const gchar* contentMimeType, const gchar* contentEncoding, const gchar* baseUri)
</span><span class="cx"> {
</span><span class="cx">     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
</span><ins>+    g_return_if_fail(content);
</ins><span class="cx"> 
</span><span class="cx">     Frame* frame = core(webkit_web_view_get_main_frame(webView));
</span><span class="cx"> 
</span><del>-    KURL url(DeprecatedString::fromUtf8(baseUri));
</del><ins>+    KURL url(baseUri ? DeprecatedString::fromUtf8(baseUri) : &quot;&quot;);
</ins><span class="cx">     RefPtr&lt;SharedBuffer&gt; sharedBuffer = new SharedBuffer(strdup(content), strlen(content));
</span><del>-    SubstituteData substituteData(sharedBuffer.release(), String(contentMimeType), String(contentEncoding), KURL(&quot;about:blank&quot;), url);
</del><ins>+    SubstituteData substituteData(sharedBuffer.release(), contentMimeType ? String(contentMimeType) : &quot;text/html&quot;, contentEncoding ? String(contentEncoding) : &quot;UTF-8&quot;, KURL(&quot;about:blank&quot;), url);
</ins><span class="cx"> 
</span><span class="cx">     frame-&gt;loader()-&gt;load(ResourceRequest(url), substituteData);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void webkit_web_view_load_html_string(WebKitWebView* webView, const gchar* content, const gchar* baseUrl)
</del><ins>+void webkit_web_view_load_html_string(WebKitWebView* webView, const gchar* content, const gchar* baseUri)
</ins><span class="cx"> {
</span><span class="cx">     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
</span><ins>+    g_return_if_fail(content);
</ins><span class="cx"> 
</span><del>-    webkit_web_view_load_string(webView, content, &quot;text/html&quot;, &quot;UTF-8&quot;, baseUrl);
</del><ins>+    webkit_web_view_load_string(webView, content, NULL, NULL, baseUri);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void webkit_web_view_stop_loading(WebKitWebView* webView)
</span></span></pre>
</div>
</div>

</body>
</html>