Title: [104552] trunk/Source/WebCore
Revision
104552
Author
[email protected]
Date
2012-01-10 04:19:42 -0800 (Tue, 10 Jan 2012)

Log Message

Add NULL checks to setting access obtained on frame and document.
https://bugs.webkit.org/show_bug.cgi?id=72002

Patch by Grzegorz Czajkowski <[email protected]> on 2012-01-10
Reviewed by Andreas Kling.

Adds NULL checks to setting object where it's required.
Generally WebCore checks NULL which may be returned from setting object obtained
on frame or document but in some cases these are skipped. These checks are not
needed to setting's access on page object.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::shouldAccelerate):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::scheduleArchiveLoad):
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::requestPlugin):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::selectCache):
(WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
* page/DragController.cpp:
(WebCore::DragController::draggableNode):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseReleaseEvent):
* page/FocusController.cpp:
(WebCore::FocusController::advanceFocusInDocumentOrder):
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::flattenFrameSet):
* rendering/RenderIFrame.cpp:
(WebCore::RenderIFrame::flattenFrame):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateBacking):
* rendering/RenderText.cpp:
(WebCore::SecureTextTimer::restartWithNewText):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (104551 => 104552)


--- trunk/Source/WebCore/ChangeLog	2012-01-10 12:11:42 UTC (rev 104551)
+++ trunk/Source/WebCore/ChangeLog	2012-01-10 12:19:42 UTC (rev 104552)
@@ -1,3 +1,39 @@
+2012-01-10  Grzegorz Czajkowski  <[email protected]>
+
+        Add NULL checks to setting access obtained on frame and document.
+        https://bugs.webkit.org/show_bug.cgi?id=72002
+
+        Reviewed by Andreas Kling.
+
+        Adds NULL checks to setting object where it's required.
+        Generally WebCore checks NULL which may be returned from setting object obtained
+        on frame or document but in some cases these are skipped. These checks are not
+        needed to setting's access on page object.
+
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::shouldAccelerate):
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::scheduleArchiveLoad):
+        * loader/SubframeLoader.cpp:
+        (WebCore::SubframeLoader::requestPlugin):
+        * loader/appcache/ApplicationCacheGroup.cpp:
+        (WebCore::ApplicationCacheGroup::selectCache):
+        (WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
+        * page/DragController.cpp:
+        (WebCore::DragController::draggableNode):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleMouseReleaseEvent):
+        * page/FocusController.cpp:
+        (WebCore::FocusController::advanceFocusInDocumentOrder):
+        * rendering/RenderFrameSet.cpp:
+        (WebCore::RenderFrameSet::flattenFrameSet):
+        * rendering/RenderIFrame.cpp:
+        (WebCore::RenderIFrame::flattenFrame):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateBacking):
+        * rendering/RenderText.cpp:
+        (WebCore::SecureTextTimer::restartWithNewText):
+
 2012-01-10  Andreas Kling  <[email protected]>
 
         Matched declaration cache should support mapped attribute declarations.

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (104551 => 104552)


--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2012-01-10 12:11:42 UTC (rev 104551)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2012-01-10 12:19:42 UTC (rev 104552)
@@ -423,13 +423,13 @@
 {
 #if USE(IOSURFACE_CANVAS_BACKING_STORE)
     UNUSED_PARAM(size);
-    return document()->settings()->canvasUsesAcceleratedDrawing();
+    return document()->settings() && document()->settings()->canvasUsesAcceleratedDrawing();
 #elif ENABLE(ACCELERATED_2D_CANVAS)
     if (m_context && !m_context->is2d())
         return false;
 
     Settings* settings = document()->settings();
-    if (!settings->accelerated2dCanvasEnabled())
+    if (!settings || !settings->accelerated2dCanvasEnabled())
         return false;
 
     // Do not use acceleration for small canvas.

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (104551 => 104552)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2012-01-10 12:11:42 UTC (rev 104551)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2012-01-10 12:19:42 UTC (rev 104552)
@@ -640,7 +640,7 @@
 #if ENABLE(WEB_ARCHIVE)
     case Archive::WebArchive:
         // WebArchiveDebugMode means we fail loads instead of trying to fetch them from the network if they're not in the archive.
-        return m_frame->settings()->webArchiveDebugModeEnabled() && ArchiveFactory::isArchiveMimeType(responseMIMEType());
+        return m_frame->settings() && m_frame->settings()->webArchiveDebugModeEnabled() && ArchiveFactory::isArchiveMimeType(responseMIMEType());
 #endif
 #if ENABLE(MHTML)
     case Archive::MHTML:

Modified: trunk/Source/WebCore/loader/SubframeLoader.cpp (104551 => 104552)


--- trunk/Source/WebCore/loader/SubframeLoader.cpp	2012-01-10 12:11:42 UTC (rev 104551)
+++ trunk/Source/WebCore/loader/SubframeLoader.cpp	2012-01-10 12:19:42 UTC (rev 104552)
@@ -109,7 +109,7 @@
          // as opposed to third-party code such as Flash. The user agent decides whether or not they are
          // permitted, rather than WebKit.
          && !MIMETypeRegistry::isApplicationPluginMIMEType(mimeType))
-        || (!settings->isJavaEnabled() && MIMETypeRegistry::isJavaAppletMIMEType(mimeType)))
+        || ((!settings || !settings->isJavaEnabled()) && MIMETypeRegistry::isJavaAppletMIMEType(mimeType)))
         return false;
 
     if (m_frame->document()) {

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp (104551 => 104552)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp	2012-01-10 12:11:42 UTC (rev 104551)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp	2012-01-10 12:19:42 UTC (rev 104552)
@@ -138,7 +138,7 @@
 {
     ASSERT(frame && frame->page());
     
-    if (!frame->settings()->offlineWebApplicationCacheEnabled())
+    if (!frame->settings() || !frame->settings()->offlineWebApplicationCacheEnabled())
         return;
     
     DocumentLoader* documentLoader = frame->loader()->documentLoader();
@@ -193,7 +193,7 @@
         return;
 
     // Don't change anything on disk if private browsing is enabled.
-    if (!frame->settings() || frame->settings()->privateBrowsingEnabled()) {
+    if (frame->settings()->privateBrowsingEnabled()) {
         postListenerTask(ApplicationCacheHost::CHECKING_EVENT, documentLoader);
         postListenerTask(ApplicationCacheHost::ERROR_EVENT, documentLoader);
         return;
@@ -211,7 +211,7 @@
 
 void ApplicationCacheGroup::selectCacheWithoutManifestURL(Frame* frame)
 {
-    if (!frame->settings()->offlineWebApplicationCacheEnabled())
+    if (!frame->settings() || !frame->settings()->offlineWebApplicationCacheEnabled())
         return;
 
     DocumentLoader* documentLoader = frame->loader()->documentLoader();

Modified: trunk/Source/WebCore/page/DragController.cpp (104551 => 104552)


--- trunk/Source/WebCore/page/DragController.cpp	2012-01-10 12:11:42 UTC (rev 104551)
+++ trunk/Source/WebCore/page/DragController.cpp	2012-01-10 12:19:42 UTC (rev 104552)
@@ -626,6 +626,7 @@
             if (dragMode == DRAG_AUTO) {
                 if ((m_dragSourceAction & DragSourceActionImage)
                     && node->hasTagName(HTMLNames::imgTag)
+                    && src->settings()
                     && src->settings()->loadsImagesAutomatically()) {
                     state.m_dragType = static_cast<DragSourceAction>(state.m_dragType | DragSourceActionImage);
                     return node;

Modified: trunk/Source/WebCore/page/EventHandler.cpp (104551 => 104552)


--- trunk/Source/WebCore/page/EventHandler.cpp	2012-01-10 12:11:42 UTC (rev 104551)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2012-01-10 12:19:42 UTC (rev 104552)
@@ -771,7 +771,7 @@
             && event.event().button() != RightButton) {
         VisibleSelection newSelection;
         Node* node = targetNode(event);
-        bool caretBrowsing = m_frame->settings()->caretBrowsingEnabled();
+        bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
         if (node && (caretBrowsing || node->rendererIsEditable()) && node->renderer()) {
             VisiblePosition pos = node->renderer()->positionForPoint(event.localPoint());
             newSelection = VisibleSelection(pos);

Modified: trunk/Source/WebCore/page/FocusController.cpp (104551 => 104552)


--- trunk/Source/WebCore/page/FocusController.cpp	2012-01-10 12:11:42 UTC (rev 104551)
+++ trunk/Source/WebCore/page/FocusController.cpp	2012-01-10 12:19:42 UTC (rev 104552)
@@ -244,7 +244,7 @@
 
     Node* currentNode = document->focusedNode();
     // FIXME: Not quite correct when it comes to focus transitions leaving/entering the WebView itself
-    bool caretBrowsing = focusedOrMainFrame()->settings()->caretBrowsingEnabled();
+    bool caretBrowsing = frame->settings() && frame->settings()->caretBrowsingEnabled();
 
     if (caretBrowsing && !currentNode)
         currentNode = frame->selection()->start().deprecatedNode();

Modified: trunk/Source/WebCore/rendering/RenderFrameSet.cpp (104551 => 104552)


--- trunk/Source/WebCore/rendering/RenderFrameSet.cpp	2012-01-10 12:11:42 UTC (rev 104551)
+++ trunk/Source/WebCore/rendering/RenderFrameSet.cpp	2012-01-10 12:19:42 UTC (rev 104552)
@@ -662,7 +662,7 @@
 
 bool RenderFrameSet::flattenFrameSet() const
 {
-    return frame() && frame()->settings()->frameFlatteningEnabled();
+    return frame() && frame()->settings() && frame()->settings()->frameFlatteningEnabled();
 }
 
 void RenderFrameSet::startResizing(GridAxis& axis, int position)

Modified: trunk/Source/WebCore/rendering/RenderIFrame.cpp (104551 => 104552)


--- trunk/Source/WebCore/rendering/RenderIFrame.cpp	2012-01-10 12:11:42 UTC (rev 104551)
+++ trunk/Source/WebCore/rendering/RenderIFrame.cpp	2012-01-10 12:19:42 UTC (rev 104552)
@@ -95,7 +95,7 @@
     }
 
     Frame* frame = element->document()->frame();
-    bool enabled = frame && frame->settings()->frameFlatteningEnabled();
+    bool enabled = frame && frame->settings() && frame->settings()->frameFlatteningEnabled();
 
     if (!enabled || !frame->page())
         return false;

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (104551 => 104552)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-01-10 12:11:42 UTC (rev 104551)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-01-10 12:19:42 UTC (rev 104552)
@@ -368,7 +368,8 @@
             layer->ensureBacking();
 
 #if PLATFORM(MAC) && USE(CA)
-            if (m_renderView->document()->settings()->acceleratedDrawingEnabled())
+            Settings* settings = m_renderView->document()->settings();
+            if (settings && settings->acceleratedDrawingEnabled())
                 layer->backing()->graphicsLayer()->setAcceleratesDrawing(true);
             else if (layer->renderer()->isCanvas()) {
                 HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(layer->renderer()->node());

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (104551 => 104552)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2012-01-10 12:11:42 UTC (rev 104551)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2012-01-10 12:19:42 UTC (rev 104552)
@@ -68,7 +68,8 @@
     void restartWithNewText(unsigned lastTypedCharacterOffset)
     {
         m_lastTypedCharacterOffset = lastTypedCharacterOffset;
-        startOneShot(m_renderText->document()->settings()->passwordEchoDurationInSeconds());
+        if (Settings* settings = m_renderText->document()->settings())
+            startOneShot(settings->passwordEchoDurationInSeconds());
     }
     void invalidate() { m_lastTypedCharacterOffset = -1; }
     unsigned lastTypedCharacterOffset() { return m_lastTypedCharacterOffset; }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to