Title: [126817] trunk/Source/WebCore
Revision
126817
Author
[email protected]
Date
2012-08-27 16:29:06 -0700 (Mon, 27 Aug 2012)

Log Message

Delete checks for impossible conditions in V8DOMWindowShell
https://bugs.webkit.org/show_bug.cgi?id=95145

Reviewed by Eric Seidel.

These situations do not occur. We don't need to check for them.

* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::updateDocument):
* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::V8DOMWindowShell::createNewContext):
(WebCore::V8DOMWindowShell::updateDocumentProperty):
(WebCore::V8DOMWindowShell::setSecurityToken):
(WebCore::V8DOMWindowShell::updateDocument):
* page/Frame.cpp:
(WebCore::Frame::setDocument):
    - updateDocument used to just return early when m_doc was 0. Now we
      don't even bother to call it.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126816 => 126817)


--- trunk/Source/WebCore/ChangeLog	2012-08-27 23:13:54 UTC (rev 126816)
+++ trunk/Source/WebCore/ChangeLog	2012-08-27 23:29:06 UTC (rev 126817)
@@ -1,3 +1,24 @@
+2012-08-27  Adam Barth  <[email protected]>
+
+        Delete checks for impossible conditions in V8DOMWindowShell
+        https://bugs.webkit.org/show_bug.cgi?id=95145
+
+        Reviewed by Eric Seidel.
+
+        These situations do not occur. We don't need to check for them.
+
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::updateDocument):
+        * bindings/v8/V8DOMWindowShell.cpp:
+        (WebCore::V8DOMWindowShell::createNewContext):
+        (WebCore::V8DOMWindowShell::updateDocumentProperty):
+        (WebCore::V8DOMWindowShell::setSecurityToken):
+        (WebCore::V8DOMWindowShell::updateDocument):
+        * page/Frame.cpp:
+        (WebCore::Frame::setDocument):
+            - updateDocument used to just return early when m_doc was 0. Now we
+              don't even bother to call it.
+
 2012-08-27  Nikhil Bhargava  <[email protected]>
 
         Split LayoutTypes.h to improve compile time

Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (126816 => 126817)


--- trunk/Source/WebCore/bindings/js/ScriptController.cpp	2012-08-27 23:13:54 UTC (rev 126816)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp	2012-08-27 23:29:06 UTC (rev 126817)
@@ -293,9 +293,6 @@
 
 void ScriptController::updateDocument()
 {
-    if (!m_frame->document())
-        return;
-
     for (ShellMap::iterator iter = m_windowShells.begin(); iter != m_windowShells.end(); ++iter) {
         JSLockHolder lock(iter->first->globalData());
         iter->second->window()->updateDocument();

Modified: trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp (126816 => 126817)


--- trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp	2012-08-27 23:13:54 UTC (rev 126816)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp	2012-08-27 23:29:06 UTC (rev 126817)
@@ -331,6 +331,7 @@
     v8::Persistent<v8::Context> result;
 
     // The activeDocumentLoader pointer could be 0 during frame shutdown.
+    // FIXME: Can we remove this check?
     if (!m_frame->loader()->activeDocumentLoader())
         return result;
 
@@ -414,19 +415,6 @@
     // FIXME: Should we use a new Local handle here?
     v8::Context::Scope contextScope(m_context.get());
 
-    // If the document has no frame, NodeToV8Object might get the
-    // document wrapper for a document that is about to be deleted.
-    // If the ForceSet below causes a garbage collection, the document
-    // might get deleted and the global handle for the document
-    // wrapper cleared. Using the cleared global handle will lead to
-    // crashes. In this case we clear the cache and let the DOMWindow
-    // accessor handle access to the document.
-    // FIXME: This should not be possible anymore.
-    if (!m_frame->document()->frame()) {
-        clearDocumentProperty();
-        return;
-    }
-
     v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document());
     ASSERT(documentWrapper == m_document.get() || m_document.isEmpty());
     if (m_document.isEmpty())
@@ -459,12 +447,6 @@
 {
     Document* document = m_frame->document();
 
-    // FIXME: This shouldn't be possible anymore.
-    if (!document) {
-        m_context->UseDefaultSecurityToken();
-        return;
-    }
-
     // Ask the document's SecurityOrigin to generate a security token.
     // If two tokens are equal, then the SecurityOrigins canAccess each other.
     // If two tokens are not equal, then we have to call canAccess.
@@ -493,24 +475,11 @@
 
 void V8DOMWindowShell::updateDocument()
 {
-    // FIXME: This shouldn't be possible anymore.
-    if (!m_frame->document())
-        return;
-
     if (m_global.isEmpty())
         return;
-
-    // There is an existing _javascript_ wrapper for the global object
-    // of this frame. _javascript_ code in other frames might hold a
-    // reference to this wrapper. We eagerly initialize the _javascript_
-    // context for the new document to make property access on the
-    // global object wrapper succeed.
     if (!initializeIfNeeded())
         return;
-
-    // We have a new document and we need to update the cache.
     updateDocumentProperty();
-
     updateSecurityOrigin();
 }
 

Modified: trunk/Source/WebCore/page/Frame.cpp (126816 => 126817)


--- trunk/Source/WebCore/page/Frame.cpp	2012-08-27 23:13:54 UTC (rev 126816)
+++ trunk/Source/WebCore/page/Frame.cpp	2012-08-27 23:29:06 UTC (rev 126817)
@@ -303,11 +303,10 @@
     if (m_doc && !m_doc->attached())
         m_doc->attach();
 
-    // Update the cached 'document' property, which is now stale.
-    m_script.updateDocument();
-
-    if (m_doc)
+    if (m_doc) {
+        m_script.updateDocument();
         m_doc->updateViewportArguments();
+    }
 
     if (m_page && m_page->mainFrame() == this) {
         notifyChromeClientWheelEventHandlerCountChanged();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to