[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

kevino at webkit.org kevino at webkit.org
Wed Apr 7 23:29:57 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit f933cd85e94c40bd805b82af24aacee5ad2adcb5
Author: kevino at webkit.org <kevino at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 10 23:31:59 2009 +0000

    Reviewed by Kevin Ollivier.
    
    Add sanity checks to RunScript to ensure it doesn't run when the document hasn't yet
    loaded nor when JavaScript is disabled.
    
    https://bugs.webkit.org/show_bug.cgi?id=31309
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50777 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog
index 7202b7f..2e8c284 100644
--- a/WebKit/wx/ChangeLog
+++ b/WebKit/wx/ChangeLog
@@ -1,3 +1,15 @@
+2009-11-10  Robin Dunn  <robin at alldunn.com>
+
+        Reviewed by Kevin Ollivier.
+
+        Add sanity checks to RunScript to ensure it doesn't run when the document hasn't yet
+        loaded nor when JavaScript is disabled.
+        
+        https://bugs.webkit.org/show_bug.cgi?id=31309
+
+        * WebFrame.cpp:
+        (wxWebFrame::RunScript):
+
 2009-11-04  Kevin Watters  <kevinwatters at gmail.com>
 
         Reviewed by Kevin Ollivier.
diff --git a/WebKit/wx/WebFrame.cpp b/WebKit/wx/WebFrame.cpp
index a497e65..c7e6d6b 100644
--- a/WebKit/wx/WebFrame.cpp
+++ b/WebKit/wx/WebFrame.cpp
@@ -187,10 +187,19 @@ wxString wxWebFrame::GetExternalRepresentation()
 wxString wxWebFrame::RunScript(const wxString& javascript)
 {
     wxString returnValue = wxEmptyString;
-    if (m_impl->frame) {
-        JSC::JSValue result = m_impl->frame->script()->executeScript(javascript, true).jsValue();
-        if (result)
-            returnValue = wxString(result.toString(m_impl->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec()).UTF8String().c_str(), wxConvUTF8);        
+    if (m_impl->frame && m_impl->frame->loader()) {
+        bool hasLoaded = m_impl->frame->loader()->frameHasLoaded();
+        wxASSERT_MSG(hasLoaded, wxT("Document must be loaded before calling RunScript."));
+        if (hasLoaded) {
+            WebCore::ScriptController* controller = m_impl->frame->script();
+            bool jsEnabled = controller->isEnabled(); 
+            wxASSERT_MSG(jsEnabled, wxT("RunScript requires JavaScript to be enabled."));
+            if (jsEnabled) {
+                JSC::JSValue result = controller->executeScript(javascript, true).jsValue();
+                if (result)
+                    returnValue = wxString(result.toString(m_impl->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec()).UTF8String().c_str(), wxConvUTF8);        
+            }
+        }
     }
     return returnValue;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list