[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
abarth at webkit.org
abarth at webkit.org
Thu Oct 29 20:42:19 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit fc80bad9b76a094f144bb2c08ba7ed65aca0e5ae
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 9 05:08:51 2009 +0000
2009-10-08 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
Move executeScript from FrameLoader to ScriptController
https://bugs.webkit.org/show_bug.cgi?id=30200
Update API call.
* Api/qwebframe.cpp:
(QWebFrame::evaluateJavaScript):
2009-10-08 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
Move executeScript from FrameLoader to ScriptController
https://bugs.webkit.org/show_bug.cgi?id=30200
Update API call.
* webkit/webkitwebview.cpp:
(webkit_web_view_execute_script):
2009-10-08 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
Move executeScript from FrameLoader to ScriptController
https://bugs.webkit.org/show_bug.cgi?id=30200
Update API call.
* WebView.cpp:
(WebView::stringByEvaluatingJavaScriptFromString):
2009-10-08 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
Move executeScript from FrameLoader to ScriptController
https://bugs.webkit.org/show_bug.cgi?id=30200
Update API call.
* WebFrame.cpp:
(wxWebFrame::RunScript):
2009-10-08 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
Move executeScript from FrameLoader to ScriptController
https://bugs.webkit.org/show_bug.cgi?id=30200
Update API call.
* WebView/WebFrame.mm:
(-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
* WebView/WebView.mm:
(-[WebView aeDescByEvaluatingJavaScriptFromString:]):
2009-10-08 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
Move executeScript from FrameLoader to ScriptController
https://bugs.webkit.org/show_bug.cgi?id=30200
These methods have virtually no interaction with FrameLoader. They
really seem like they ought to belong to ScriptController.
* WebCore.base.exp:
* bindings/js/ScheduledAction.cpp:
(WebCore::ScheduledAction::execute):
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::ScriptController):
(WebCore::ScriptController::executeScript):
(WebCore::ScriptController::executeIfJavaScriptURL):
(WebCore::ScriptController::evaluate):
* bindings/js/ScriptController.h:
* bindings/v8/ScriptController.cpp:
(WebCore::ScriptController::ScriptController):
(WebCore::ScriptController::executeScript):
(WebCore::ScriptController::executeIfJavaScriptURL):
* bindings/v8/ScriptController.h:
* dom/XMLTokenizer.cpp:
(WebCore::XMLTokenizer::notifyFinished):
* dom/XMLTokenizerLibxml2.cpp:
(WebCore::XMLTokenizer::endElementNs):
* dom/XMLTokenizerQt.cpp:
(WebCore::XMLTokenizer::parseEndElement):
* html/HTMLTokenizer.cpp:
(WebCore::HTMLTokenizer::scriptExecution):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::changeLocation):
(WebCore::FrameLoader::urlSelected):
(WebCore::FrameLoader::requestFrame):
(WebCore::FrameLoader::submitForm):
(WebCore::FrameLoader::replaceDocument):
* loader/FrameLoader.h:
* plugins/PluginView.cpp:
(WebCore::PluginView::performRequest):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49372 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 467cd27..2c17eef 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,45 @@
+2009-10-08 Adam Barth <abarth at webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Move executeScript from FrameLoader to ScriptController
+ https://bugs.webkit.org/show_bug.cgi?id=30200
+
+ These methods have virtually no interaction with FrameLoader. They
+ really seem like they ought to belong to ScriptController.
+
+ * WebCore.base.exp:
+ * bindings/js/ScheduledAction.cpp:
+ (WebCore::ScheduledAction::execute):
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::ScriptController):
+ (WebCore::ScriptController::executeScript):
+ (WebCore::ScriptController::executeIfJavaScriptURL):
+ (WebCore::ScriptController::evaluate):
+ * bindings/js/ScriptController.h:
+ * bindings/v8/ScriptController.cpp:
+ (WebCore::ScriptController::ScriptController):
+ (WebCore::ScriptController::executeScript):
+ (WebCore::ScriptController::executeIfJavaScriptURL):
+ * bindings/v8/ScriptController.h:
+ * dom/XMLTokenizer.cpp:
+ (WebCore::XMLTokenizer::notifyFinished):
+ * dom/XMLTokenizerLibxml2.cpp:
+ (WebCore::XMLTokenizer::endElementNs):
+ * dom/XMLTokenizerQt.cpp:
+ (WebCore::XMLTokenizer::parseEndElement):
+ * html/HTMLTokenizer.cpp:
+ (WebCore::HTMLTokenizer::scriptExecution):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::changeLocation):
+ (WebCore::FrameLoader::urlSelected):
+ (WebCore::FrameLoader::requestFrame):
+ (WebCore::FrameLoader::submitForm):
+ (WebCore::FrameLoader::replaceDocument):
+ * loader/FrameLoader.h:
+ * plugins/PluginView.cpp:
+ (WebCore::PluginView::performRequest):
+
2009-10-08 Geoffrey Garen <ggaren at apple.com>
Windows build fix: added missing #include.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index c4ab425..ae6f192 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -476,6 +476,7 @@ webcore_sources += \
WebCore/bindings/js/SerializedScriptValue.cpp \
WebCore/bindings/js/SerializedScriptValue.h \
WebCore/bindings/js/StringSourceProvider.h \
+ WebCore/bindings/ScriptControllerBase.cpp \
WebCore/bridge/IdentifierRep.cpp \
WebCore/bridge/IdentifierRep.h \
WebCore/bridge/NP_jsobject.cpp \
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index 24d8355..f9e156e 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -156,7 +156,6 @@ __ZN7WebCore11FrameLoader11completeURLERKNS_6StringE
__ZN7WebCore11FrameLoader11loadArchiveEN3WTF10PassRefPtrINS_7ArchiveEEE
__ZN7WebCore11FrameLoader11setEncodingERKNS_6StringEb
__ZN7WebCore11FrameLoader12shouldReloadERKNS_4KURLES3_
-__ZN7WebCore11FrameLoader13executeScriptERKNS_6StringEb
__ZN7WebCore11FrameLoader14detachChildrenEv
__ZN7WebCore11FrameLoader14scrollToAnchorERKNS_4KURLE
__ZN7WebCore11FrameLoader14stopAllLoadersENS_14DatabasePolicyE
@@ -376,6 +375,7 @@ __ZN7WebCore16NavigationActionC1ERKNS_4KURLENS_13FrameLoadTypeEb
__ZN7WebCore16NavigationActionC1ERKNS_4KURLENS_14NavigationTypeE
__ZN7WebCore16NavigationActionC1Ev
__ZN7WebCore16ScriptController10initScriptEv
+__ZN7WebCore16ScriptController13executeScriptERKNS_6StringEb
__ZN7WebCore16ScriptController18windowScriptObjectEv
__ZN7WebCore16VisibleSelectionC1EPKNS_5RangeENS_9EAffinityE
__ZN7WebCore16VisibleSelectionC1ERKNS_15VisiblePositionES3_
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index d82690f..3164101 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -624,6 +624,7 @@
'bindings/js/StringSourceProvider.h',
'bindings/js/WorkerScriptController.cpp',
'bindings/js/WorkerScriptController.h',
+ 'bindings/ScriptControllerBase.cpp',
'bindings/v8/ChildThreadDOMData.cpp',
'bindings/v8/ChildThreadDOMData.h',
'bindings/v8/custom/V8AbstractWorkerCustom.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 24ce0c9..c35ea20 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -767,6 +767,7 @@ SOURCES += \
bindings/js/ScriptValue.cpp \
bindings/js/ScheduledAction.cpp \
bindings/js/SerializedScriptValue.cpp \
+ bindings/ScriptControllerBase.cpp \
bridge/IdentifierRep.cpp \
bridge/NP_jsobject.cpp \
bridge/npruntime.cpp \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 9a9e3ec..0d2d898 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -29707,6 +29707,10 @@
>
</File>
</Filter>
+ <File
+ RelativePath="..\bindings\ScriptControllerBase.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="plugins"
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 0056b9c..9b35acf 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -2353,6 +2353,7 @@
979F43D41075E44A0000F83B /* RedirectScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 979F43D21075E44A0000F83B /* RedirectScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; };
97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97DD4D840FDF4D6D00ECF9A4 /* XSSAuditor.cpp */; };
97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */; };
+ 97EF7DFE107E55B700D7C49C /* ScriptControllerBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */; };
A17C81220F2A5CF7005DAAEB /* HTMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */; };
A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */; };
A718760E0B2A120100A16ECE /* DragActions.h in Headers */ = {isa = PBXBuildFile; fileRef = A718760D0B2A120100A16ECE /* DragActions.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -7546,6 +7547,7 @@
979F43D21075E44A0000F83B /* RedirectScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RedirectScheduler.h; sourceTree = "<group>"; };
97DD4D840FDF4D6D00ECF9A4 /* XSSAuditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSSAuditor.cpp; sourceTree = "<group>"; };
97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSSAuditor.h; sourceTree = "<group>"; };
+ 97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptControllerBase.cpp; sourceTree = "<group>"; };
A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElementFactory.cpp; sourceTree = "<group>"; };
A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElementFactory.h; sourceTree = "<group>"; };
A718760D0B2A120100A16ECE /* DragActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragActions.h; sourceTree = "<group>"; };
@@ -14165,6 +14167,7 @@
93F8B3070A300FEA00F61AB8 /* generate-bindings.pl */,
14813BF309EDF88E00F757E1 /* IDLParser.pm */,
93F8B3080A300FEA00F61AB8 /* IDLStructure.pm */,
+ 97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */,
);
path = bindings;
sourceTree = "<group>";
@@ -19667,6 +19670,7 @@
416E75CC0EDF90C700360E1D /* ScriptCallFrame.cpp in Sources */,
416E75BF0EDF8FD700360E1D /* ScriptCallStack.cpp in Sources */,
93B70D6F09EB0C7C009D8468 /* ScriptController.cpp in Sources */,
+ 97EF7DFE107E55B700D7C49C /* ScriptControllerBase.cpp in Sources */,
A83E1C740E49042C00140B9C /* ScriptControllerMac.mm in Sources */,
08A484770E5272C500C3FE76 /* ScriptElement.cpp in Sources */,
411046420FA222A600BA436A /* ScriptEventListener.cpp in Sources */,
diff --git a/WebCore/WebCoreSources.bkl b/WebCore/WebCoreSources.bkl
index 013b4d6..c9e104e 100644
--- a/WebCore/WebCoreSources.bkl
+++ b/WebCore/WebCoreSources.bkl
@@ -161,6 +161,7 @@ This file contains the list of files needed to build WebCore.
bindings/js/ScheduledAction.cpp
bindings/js/JSWebKitCSSMatrixConstructor.cpp
bindings/js/JSWebKitPointConstructor.cpp
+ bindings/ScriptControllerBase.cpp
</set>
<set append="1" var="WEBCORE_SOURCES_BRIDGE">
diff --git a/WebCore/bindings/ScriptControllerBase.cpp b/WebCore/bindings/ScriptControllerBase.cpp
new file mode 100644
index 0000000..0395dec
--- /dev/null
+++ b/WebCore/bindings/ScriptControllerBase.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten (porten at kde.org)
+ * Copyright (C) 2001 Peter Kelly (pmk at post.com)
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "ScriptController.h"
+
+#include "Frame.h"
+#include "Page.h"
+#include "ScriptSourceCode.h"
+#include "ScriptValue.h"
+#include "Settings.h"
+#include "XSSAuditor.h"
+
+namespace WebCore {
+
+ScriptValue ScriptController::executeScript(const String& script, bool forceUserGesture)
+{
+ return executeScript(ScriptSourceCode(script, forceUserGesture ? KURL() : m_frame->loader()->url()));
+}
+
+ScriptValue ScriptController::executeScript(const ScriptSourceCode& sourceCode)
+{
+ if (!isEnabled() || isPaused())
+ return ScriptValue();
+
+ bool wasInExecuteScript = m_inExecuteScript;
+ m_inExecuteScript = true;
+
+ ScriptValue result = evaluate(sourceCode);
+
+ if (!wasInExecuteScript) {
+ m_inExecuteScript = false;
+ Document::updateStyleForAllDocuments();
+ }
+
+ return result;
+}
+
+bool ScriptController::executeIfJavaScriptURL(const KURL& url, bool userGesture, bool replaceDocument)
+{
+ if (!protocolIsJavaScript(url))
+ return false;
+
+ if (m_frame->page() && !m_frame->page()->javaScriptURLsAreAllowed())
+ return true;
+
+ const int javascriptSchemeLength = sizeof("javascript:") - 1;
+
+ String script = url.string().substring(javascriptSchemeLength);
+ ScriptValue result;
+ if (xssAuditor()->canEvaluateJavaScriptURL(script))
+ result = executeScript(decodeURLEscapeSequences(script), userGesture);
+
+ String scriptResult;
+ if (!result.getString(scriptResult))
+ return true;
+
+ // FIXME: We should always replace the document, but doing so
+ // synchronously can cause crashes:
+ // http://bugs.webkit.org/show_bug.cgi?id=16782
+ if (replaceDocument)
+ m_frame->loader()->replaceDocument(scriptResult);
+
+ return true;
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/js/ScheduledAction.cpp b/WebCore/bindings/js/ScheduledAction.cpp
index 9e64bce..93155e1 100644
--- a/WebCore/bindings/js/ScheduledAction.cpp
+++ b/WebCore/bindings/js/ScheduledAction.cpp
@@ -125,7 +125,7 @@ void ScheduledAction::execute(Document* document)
executeFunctionInContext(window, window->shell());
Document::updateStyleForAllDocuments();
} else
- frame->loader()->executeScript(m_code);
+ frame->script()->executeScript(m_code);
frame->script()->setProcessingTimerCallback(false);
}
diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp
index dfa1602..e99bb35 100644
--- a/WebCore/bindings/js/ScriptController.cpp
+++ b/WebCore/bindings/js/ScriptController.cpp
@@ -48,6 +48,7 @@ ScriptController::ScriptController(Frame* frame)
: m_frame(frame)
, m_handlerLineNumber(0)
, m_sourceURL(0)
+ , m_inExecuteScript(false)
, m_processingTimerCallback(false)
, m_paused(false)
, m_allowPopupsFromPlugin(false)
@@ -84,7 +85,7 @@ ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
{
const SourceCode& jsSourceCode = sourceCode.jsSourceCode();
String sourceURL = jsSourceCode.provider()->url();
-
+
if (!m_XSSAuditor->canEvaluate(sourceCode.source())) {
// This script is not safe to be evaluated.
return JSValue();
diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h
index 56e8f0c..bd4b65e 100644
--- a/WebCore/bindings/js/ScriptController.h
+++ b/WebCore/bindings/js/ScriptController.h
@@ -80,6 +80,12 @@ public:
return m_windowShell->window();
}
+ ScriptValue executeScript(const ScriptSourceCode&);
+ ScriptValue executeScript(const String& script, bool forceUserGesture = false);
+
+ // Returns true if argument is a JavaScript URL.
+ bool executeIfJavaScriptURL(const KURL&, bool userGesture = false, bool replaceDocument = true);
+
ScriptValue evaluate(const ScriptSourceCode&);
void evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>&);
@@ -155,6 +161,8 @@ private:
int m_handlerLineNumber;
const String* m_sourceURL;
+ bool m_inExecuteScript;
+
bool m_processingTimerCallback;
bool m_paused;
bool m_allowPopupsFromPlugin;
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
index efefed0..f808151 100644
--- a/WebCore/bindings/v8/ScriptController.cpp
+++ b/WebCore/bindings/v8/ScriptController.cpp
@@ -88,6 +88,7 @@ void ScriptController::gcUnprotectJSWrapper(void* domObject)
ScriptController::ScriptController(Frame* frame)
: m_frame(frame)
, m_sourceURL(0)
+ , m_inExecuteScript(false)
, m_processingTimerCallback(false)
, m_paused(false)
, m_proxy(new V8Proxy(frame))
diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h
index 9658b05..cd00713 100644
--- a/WebCore/bindings/v8/ScriptController.h
+++ b/WebCore/bindings/v8/ScriptController.h
@@ -59,6 +59,12 @@ namespace WebCore {
// or this accessor should be made JSProxy*
V8Proxy* proxy() { return m_proxy.get(); }
+ ScriptValue executeScript(const ScriptSourceCode&);
+ ScriptValue executeScript(const String& script, bool forceUserGesture = false);
+
+ // Returns true if argument is a JavaScript URL.
+ bool executeIfJavaScriptURL(const KURL&, bool userGesture = false, bool replaceDocument = true);
+
// Evaluate a script file in the environment of this proxy.
// If succeeded, 'succ' is set to true and result is returned
// as a string.
@@ -162,6 +168,8 @@ namespace WebCore {
Frame* m_frame;
const String* m_sourceURL;
+ bool m_inExecuteScript;
+
bool m_processingTimerCallback;
bool m_paused;
diff --git a/WebCore/dom/XMLTokenizer.cpp b/WebCore/dom/XMLTokenizer.cpp
index 4d06343..625a9e6 100644
--- a/WebCore/dom/XMLTokenizer.cpp
+++ b/WebCore/dom/XMLTokenizer.cpp
@@ -296,7 +296,7 @@ void XMLTokenizer::notifyFinished(CachedResource* unusedResource)
if (errorOccurred)
scriptElement->dispatchErrorEvent();
else {
- m_view->frame()->loader()->executeScript(sourceCode);
+ m_view->frame()->script()->executeScript(sourceCode);
scriptElement->dispatchLoadEvent();
}
diff --git a/WebCore/dom/XMLTokenizerLibxml2.cpp b/WebCore/dom/XMLTokenizerLibxml2.cpp
index e4a98d5..2942241 100644
--- a/WebCore/dom/XMLTokenizerLibxml2.cpp
+++ b/WebCore/dom/XMLTokenizerLibxml2.cpp
@@ -862,7 +862,7 @@ void XMLTokenizer::endElementNs()
} else
m_scriptElement = 0;
} else
- m_view->frame()->loader()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine));
+ m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine));
}
m_requestingScript = false;
setCurrentNode(parent.get());
diff --git a/WebCore/dom/XMLTokenizerQt.cpp b/WebCore/dom/XMLTokenizerQt.cpp
index 04405d6..bbbf254 100644
--- a/WebCore/dom/XMLTokenizerQt.cpp
+++ b/WebCore/dom/XMLTokenizerQt.cpp
@@ -621,7 +621,7 @@ void XMLTokenizer::parseEndElement()
} else
m_scriptElement = 0;
} else
- m_view->frame()->loader()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine));
+ m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine));
}
m_requestingScript = false;
setCurrentNode(parent.get());
diff --git a/WebCore/html/HTMLTokenizer.cpp b/WebCore/html/HTMLTokenizer.cpp
index 1a2d276..64f0a64 100644
--- a/WebCore/html/HTMLTokenizer.cpp
+++ b/WebCore/html/HTMLTokenizer.cpp
@@ -561,7 +561,7 @@ HTMLTokenizer::State HTMLTokenizer::scriptExecution(const ScriptSourceCode& sour
#endif
m_state = state;
- m_doc->frame()->loader()->executeScript(sourceCode);
+ m_doc->frame()->script()->executeScript(sourceCode);
state = m_state;
state.setAllowYield(true);
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index f0a8f01..10db87f 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -175,7 +175,6 @@ FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client)
, m_sentRedirectNotification(false)
, m_inStopAllLoaders(false)
, m_isExecutingJavaScriptFormAction(false)
- , m_isRunningScript(false)
, m_didCallImplicitClose(false)
, m_wasUnloadEventEmitted(false)
, m_unloadEventBeingDispatched(false)
@@ -315,7 +314,7 @@ void FrameLoader::changeLocation(const KURL& url, const String& referrer, bool l
ResourceRequest request(url, referrer, refresh ? ReloadIgnoringCacheData : UseProtocolCachePolicy);
- if (executeIfJavaScriptURL(request.url(), userGesture))
+ if (m_frame->script()->executeIfJavaScriptURL(request.url(), userGesture))
return;
urlSelected(request, "_self", 0, lockHistory, lockBackForwardList, userGesture);
@@ -323,7 +322,7 @@ void FrameLoader::changeLocation(const KURL& url, const String& referrer, bool l
void FrameLoader::urlSelected(const ResourceRequest& request, const String& passedTarget, PassRefPtr<Event> triggeringEvent, bool lockHistory, bool lockBackForwardList, bool userGesture)
{
- if (executeIfJavaScriptURL(request.url(), userGesture, false))
+ if (m_frame->script()->executeIfJavaScriptURL(request.url(), userGesture, false))
return;
String target = passedTarget;
@@ -360,7 +359,7 @@ bool FrameLoader::requestFrame(HTMLFrameOwnerElement* ownerElement, const String
return false;
if (!scriptURL.isEmpty())
- frame->loader()->executeIfJavaScriptURL(scriptURL);
+ frame->script()->executeIfJavaScriptURL(scriptURL);
return true;
}
@@ -432,7 +431,7 @@ void FrameLoader::submitForm(const char* action, const String& url, PassRefPtr<F
if (protocolIsJavaScript(u)) {
m_isExecutingJavaScriptFormAction = true;
- executeIfJavaScriptURL(u, false, false);
+ m_frame->script()->executeIfJavaScriptURL(u, false, false);
m_isExecutingJavaScriptFormAction = false;
return;
}
@@ -647,62 +646,6 @@ void FrameLoader::didExplicitOpen()
m_URL = m_frame->document()->url();
}
-bool FrameLoader::executeIfJavaScriptURL(const KURL& url, bool userGesture, bool replaceDocument)
-{
- if (!protocolIsJavaScript(url))
- return false;
-
- if (m_frame->page() && !m_frame->page()->javaScriptURLsAreAllowed())
- return true;
-
- const int javascriptSchemeLength = sizeof("javascript:") - 1;
-
- String script = url.string().substring(javascriptSchemeLength);
- ScriptValue result;
- if (m_frame->script()->xssAuditor()->canEvaluateJavaScriptURL(script))
- result = executeScript(decodeURLEscapeSequences(script), userGesture);
-
- String scriptResult;
- if (!result.getString(scriptResult))
- return true;
-
- SecurityOrigin* currentSecurityOrigin = m_frame->document()->securityOrigin();
-
- // FIXME: We should always replace the document, but doing so
- // synchronously can cause crashes:
- // http://bugs.webkit.org/show_bug.cgi?id=16782
- if (replaceDocument) {
- stopAllLoaders();
- begin(m_URL, true, currentSecurityOrigin);
- write(scriptResult);
- end();
- }
-
- return true;
-}
-
-ScriptValue FrameLoader::executeScript(const String& script, bool forceUserGesture)
-{
- return executeScript(ScriptSourceCode(script, forceUserGesture ? KURL() : m_URL));
-}
-
-ScriptValue FrameLoader::executeScript(const ScriptSourceCode& sourceCode)
-{
- if (!m_frame->script()->isEnabled() || m_frame->script()->isPaused())
- return ScriptValue();
-
- bool wasRunningScript = m_isRunningScript;
- m_isRunningScript = true;
-
- ScriptValue result = m_frame->script()->evaluate(sourceCode);
-
- if (!wasRunningScript) {
- m_isRunningScript = false;
- Document::updateStyleForAllDocuments();
- }
-
- return result;
-}
void FrameLoader::cancelAndClear()
{
@@ -715,6 +658,14 @@ void FrameLoader::cancelAndClear()
m_frame->script()->updatePlatformScriptObjects();
}
+void FrameLoader::replaceDocument(const String& html)
+{
+ stopAllLoaders();
+ begin(m_URL, true, m_frame->document()->securityOrigin());
+ write(html);
+ end();
+}
+
void FrameLoader::clear(bool clearWindowProperties, bool clearScriptObjects, bool clearFrameView)
{
m_frame->editor()->clear();
diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h
index 022d927..897fb08 100644
--- a/WebCore/loader/FrameLoader.h
+++ b/WebCore/loader/FrameLoader.h
@@ -231,6 +231,8 @@ namespace WebCore {
KURL baseURL() const;
+ void replaceDocument(const String&);
+
void begin();
void begin(const KURL&, bool dispatchWindowObjectAvailable = true, SecurityOrigin* forcedSecurityOrigin = 0);
@@ -242,9 +244,6 @@ namespace WebCore {
void setEncoding(const String& encoding, bool userChosen);
String encoding() const;
- ScriptValue executeScript(const ScriptSourceCode&);
- ScriptValue executeScript(const String& script, bool forceUserGesture = false);
-
void gotoAnchor();
void tokenizerProcessedData();
@@ -451,9 +450,6 @@ namespace WebCore {
Frame* loadSubframe(HTMLFrameOwnerElement*, const KURL&, const String& name, const String& referrer);
- // Returns true if argument is a JavaScript URL.
- bool executeIfJavaScriptURL(const KURL&, bool userGesture = false, bool replaceDocument = true);
-
bool gotoAnchor(const String& name); // returns true if the anchor was found
void scrollToAnchor(const KURL&);
@@ -499,7 +495,6 @@ namespace WebCore {
String m_outgoingReferrer;
bool m_isExecutingJavaScriptFormAction;
- bool m_isRunningScript;
String m_responseMIMEType;
diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp
index e4b337b..1f07566 100644
--- a/WebCore/plugins/PluginView.cpp
+++ b/WebCore/plugins/PluginView.cpp
@@ -450,7 +450,7 @@ void PluginView::performRequest(PluginRequest* request)
// Executing a script can cause the plugin view to be destroyed, so we keep a reference to the parent frame.
RefPtr<Frame> parentFrame = m_parentFrame;
- JSValue result = m_parentFrame->loader()->executeScript(jsString, request->shouldAllowPopups()).jsValue();
+ JSValue result = m_parentFrame->script()->executeScript(jsString, request->shouldAllowPopups()).jsValue();
if (targetFrameName.isNull()) {
String resultString;
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 370fb2b..1093e33 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,15 @@
+2009-10-08 Adam Barth <abarth at webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Move executeScript from FrameLoader to ScriptController
+ https://bugs.webkit.org/show_bug.cgi?id=30200
+
+ Update API call.
+
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_execute_script):
+
2009-10-07 Xan Lopez <xlopez at igalia.com>
Fix the GTK+ build.
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index 47d7d98..3cb6908 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -3152,8 +3152,7 @@ void webkit_web_view_execute_script(WebKitWebView* webView, const gchar* script)
g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
g_return_if_fail(script);
- if (FrameLoader* loader = core(webView)->mainFrame()->loader())
- loader->executeScript(String::fromUTF8(script), true);
+ core(webView)->mainFrame()->script()->executeScript(String::fromUTF8(script), true);
}
/**
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index a3652e1..5b4e6f8 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,17 @@
+2009-10-08 Adam Barth <abarth at webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Move executeScript from FrameLoader to ScriptController
+ https://bugs.webkit.org/show_bug.cgi?id=30200
+
+ Update API call.
+
+ * WebView/WebFrame.mm:
+ (-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
+ * WebView/WebView.mm:
+ (-[WebView aeDescByEvaluatingJavaScriptFromString:]):
+
2009-10-08 Brady Eidson <beidson at apple.com>
Reviewed by Dan Bernstein.
diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm
index 27aac67..d59774a 100644
--- a/WebKit/mac/WebView/WebFrame.mm
+++ b/WebKit/mac/WebView/WebFrame.mm
@@ -595,7 +595,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
{
ASSERT(_private->coreFrame->document());
- JSValue result = _private->coreFrame->loader()->executeScript(string, forceUserGesture).jsValue();
+ JSValue result = _private->coreFrame->script()->executeScript(string, forceUserGesture).jsValue();
if (!_private->coreFrame) // In case the script removed our frame from the page.
return @"";
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index ca53b3a..36993ee 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -4096,7 +4096,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu
return nil;
if (!coreFrame->document())
return nil;
- JSValue result = coreFrame->loader()->executeScript(script, true).jsValue();
+ JSValue result = coreFrame->script()->executeScript(script, true).jsValue();
if (!result) // FIXME: pass errors
return 0;
JSLock lock(SilenceAssertionsOnly);
diff --git a/WebKit/qt/Api/qwebframe.cpp b/WebKit/qt/Api/qwebframe.cpp
index 1777cc8..d710dcf 100644
--- a/WebKit/qt/Api/qwebframe.cpp
+++ b/WebKit/qt/Api/qwebframe.cpp
@@ -1251,7 +1251,7 @@ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource)
ScriptController *proxy = d->frame->script();
QVariant rc;
if (proxy) {
- JSC::JSValue v = d->frame->loader()->executeScript(ScriptSourceCode(scriptSource)).jsValue();
+ JSC::JSValue v = d->frame->script()->executeScript(ScriptSourceCode(scriptSource)).jsValue();
int distance = 0;
rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject()->globalExec(), v, QMetaType::Void, &distance);
}
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 5aff018..a1e81a9 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,15 @@
+2009-10-08 Adam Barth <abarth at webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Move executeScript from FrameLoader to ScriptController
+ https://bugs.webkit.org/show_bug.cgi?id=30200
+
+ Update API call.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::evaluateJavaScript):
+
2009-10-08 Jedrzej Nowacki <jedrzej.nowacki at nokia.com>
Reviewed by Simon Hausmann.
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 4227492..ad0d523 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,15 @@
+2009-10-08 Adam Barth <abarth at webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Move executeScript from FrameLoader to ScriptController
+ https://bugs.webkit.org/show_bug.cgi?id=30200
+
+ Update API call.
+
+ * WebView.cpp:
+ (WebView::stringByEvaluatingJavaScriptFromString):
+
2009-10-08 Anders Carlsson <andersca at apple.com>
Reviewed by Sam Weinig.
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index 85b2ac2..3e13d0a 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -2865,7 +2865,7 @@ HRESULT STDMETHODCALLTYPE WebView::stringByEvaluatingJavaScriptFromString(
if (!coreFrame)
return E_FAIL;
- JSC::JSValue scriptExecutionResult = coreFrame->loader()->executeScript(WebCore::String(script), true).jsValue();
+ JSC::JSValue scriptExecutionResult = coreFrame->script()->executeScript(WebCore::String(script), true).jsValue();
if (!scriptExecutionResult)
return E_FAIL;
else if (scriptExecutionResult.isString()) {
diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog
index 76f4533..f46bac2 100644
--- a/WebKit/wx/ChangeLog
+++ b/WebKit/wx/ChangeLog
@@ -1,3 +1,15 @@
+2009-10-08 Adam Barth <abarth at webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Move executeScript from FrameLoader to ScriptController
+ https://bugs.webkit.org/show_bug.cgi?id=30200
+
+ Update API call.
+
+ * WebFrame.cpp:
+ (wxWebFrame::RunScript):
+
2009-10-07 Adam Barth <abarth at webkit.org>
Reviewed by Darin Adler.
diff --git a/WebKit/wx/WebFrame.cpp b/WebKit/wx/WebFrame.cpp
index f205152..38b3e3f 100644
--- a/WebKit/wx/WebFrame.cpp
+++ b/WebKit/wx/WebFrame.cpp
@@ -188,7 +188,7 @@ wxString wxWebFrame::RunScript(const wxString& javascript)
{
wxString returnValue = wxEmptyString;
if (m_impl->frame) {
- JSC::JSValue result = m_impl->frame->loader()->executeScript(javascript, true).jsValue();
+ JSC::JSValue result = m_impl->frame->script()->executeScript(javascript, true).jsValue();
if (result)
returnValue = wxString(result.toString(m_impl->frame->script()->globalObject()->globalExec()).UTF8String().c_str(), wxConvUTF8);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list