Title: [120774] trunk/Source/WebKit/blackberry
- Revision
- 120774
- Author
- [email protected]
- Date
- 2012-06-19 16:50:32 -0700 (Tue, 19 Jun 2012)
Log Message
[BlackBerry] Should check the return value of fromUTF8() before executing the script.
https://bugs.webkit.org/show_bug.cgi?id=89500
Patch by Yong Li <[email protected]> on 2012-06-19
Reviewed by Rob Buis.
PR# 166623.
WebPagePrivate::executeJavaScript() should check the return value of fromUTF8()
before executing the script to avoid potential crash on invalid script source.
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::executeJavaScript):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (120773 => 120774)
--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-06-19 23:47:25 UTC (rev 120773)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-06-19 23:50:32 UTC (rev 120774)
@@ -703,9 +703,21 @@
d->loadString(string, baseURL, mimeType, failingURL);
}
-bool WebPagePrivate::executeJavaScript(const char* script, _javascript_DataType& returnType, WebString& returnValue)
+bool WebPagePrivate::executeJavaScript(const char* scriptUTF8, _javascript_DataType& returnType, WebString& returnValue)
{
- ScriptValue result = m_mainFrame->script()->executeScript(String::fromUTF8(script), false);
+ String script = String::fromUTF8(scriptUTF8);
+
+ if (script.isNull()) {
+ returnType = JSException;
+ return false;
+ }
+
+ if (script.isEmpty()) {
+ returnType = JSUndefined;
+ return true;
+ }
+
+ ScriptValue result = m_mainFrame->script()->executeScript(script, false);
JSC::JSValue value = result.jsValue();
if (!value) {
returnType = JSException;
Modified: trunk/Source/WebKit/blackberry/ChangeLog (120773 => 120774)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-06-19 23:47:25 UTC (rev 120773)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-06-19 23:50:32 UTC (rev 120774)
@@ -1,3 +1,17 @@
+2012-06-19 Yong Li <[email protected]>
+
+ [BlackBerry] Should check the return value of fromUTF8() before executing the script.
+ https://bugs.webkit.org/show_bug.cgi?id=89500
+
+ Reviewed by Rob Buis.
+ PR# 166623.
+
+ WebPagePrivate::executeJavaScript() should check the return value of fromUTF8()
+ before executing the script to avoid potential crash on invalid script source.
+
+ * Api/WebPage.cpp:
+ (BlackBerry::WebKit::WebPagePrivate::executeJavaScript):
+
2012-06-19 Jakob Petsovits <[email protected]>
[BlackBerry] Missing notifyContentRendered() when resuming rendering
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes