Title: [94102] trunk/Source/WebKit/chromium
- Revision
- 94102
- Author
- [email protected]
- Date
- 2011-08-30 13:23:51 -0700 (Tue, 30 Aug 2011)
Log Message
[Chromium] Add null checks for document()->loader()
https://bugs.webkit.org/show_bug.cgi?id=67077
Reviewed by Nate Chapin.
Document::loader can return 0 for a number of reasons. Call sites need
to null check the result, like we do for Document::frame. I suspect
some of these are real crashes, along the lines of
http://trac.webkit.org/changeset/93692, but null checking this function
is just good practice.
* src/ContextMenuClientImpl.cpp:
(WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
* src/WebSearchableFormData.cpp:
(HTMLNames::GetFormEncoding):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::pageEncoding):
Modified Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (94101 => 94102)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-08-30 20:17:09 UTC (rev 94101)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-08-30 20:23:51 UTC (rev 94102)
@@ -1,3 +1,23 @@
+2011-08-30 Adam Barth <[email protected]>
+
+ [Chromium] Add null checks for document()->loader()
+ https://bugs.webkit.org/show_bug.cgi?id=67077
+
+ Reviewed by Nate Chapin.
+
+ Document::loader can return 0 for a number of reasons. Call sites need
+ to null check the result, like we do for Document::frame. I suspect
+ some of these are real crashes, along the lines of
+ http://trac.webkit.org/changeset/93692, but null checking this function
+ is just good practice.
+
+ * src/ContextMenuClientImpl.cpp:
+ (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
+ * src/WebSearchableFormData.cpp:
+ (HTMLNames::GetFormEncoding):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::pageEncoding):
+
2011-08-29 Darin Fisher <[email protected]>
[chromium] DumpRenderTree should be explicit about its dependency on
Modified: trunk/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp (94101 => 94102)
--- trunk/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp 2011-08-30 20:17:09 UTC (rev 94101)
+++ trunk/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp 2011-08-30 20:23:51 UTC (rev 94102)
@@ -243,7 +243,8 @@
// If it's not a link, an image, a media element, or an image/media link,
// show a selection menu or a more generic page menu.
- data.frameEncoding = selectedFrame->document()->loader()->writer()->encoding();
+ if (selectedFrame->document()->loader())
+ data.frameEncoding = selectedFrame->document()->loader()->writer()->encoding();
// Send the frame and page URLs in any case.
data.pageURL = urlFromFrame(m_webView->mainFrameImpl()->frame());
Modified: trunk/Source/WebKit/chromium/src/WebSearchableFormData.cpp (94101 => 94102)
--- trunk/Source/WebKit/chromium/src/WebSearchableFormData.cpp 2011-08-30 20:17:09 UTC (rev 94101)
+++ trunk/Source/WebKit/chromium/src/WebSearchableFormData.cpp 2011-08-30 20:23:51 UTC (rev 94102)
@@ -64,7 +64,7 @@
if (encoding->isValid())
return;
}
- if (!form->document()->frame())
+ if (!form->document()->loader())
return;
*encoding = TextEncoding(form->document()->loader()->writer()->encoding());
}
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (94101 => 94102)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-08-30 20:17:09 UTC (rev 94101)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-08-30 20:23:51 UTC (rev 94102)
@@ -1643,6 +1643,9 @@
if (!m_page.get())
return WebString();
+ if (!m_page->mainFrame()->document()->loader())
+ return WebString();
+
return m_page->mainFrame()->document()->loader()->writer()->encoding();
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes