[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andersca at apple.com
andersca at apple.com
Wed Dec 22 11:38:14 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 7c20d6fc07ea537a1bc8012de21c950a290ce4df
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Aug 1 23:05:55 2010 +0000
Implement NPN_SetException
https://bugs.webkit.org/show_bug.cgi?id=43320
Reviewed by Sam Weinig.
* WebProcess/Plugins/JSNPObject.cpp:
(WebKit::JSNPObject::callConstructor):
(WebKit::JSNPObject::put):
(WebKit::JSNPObject::getOwnPropertyNames):
(WebKit::JSNPObject::propertyGetter):
Call NPRuntimeObjectMap::moveGlobalExceptionToExecState.
* WebProcess/Plugins/NPRuntimeObjectMap.cpp:
(WebKit::globalExceptionString):
Add static global.
(WebKit::NPRuntimeObjectMap::setGlobalException):
Set the global exception string.
(WebKit::NPRuntimeObjectMap::moveGlobalExceptionToExecState):
Create an error from the exception string.
* WebProcess/Plugins/NPRuntimeObjectMap.h:
* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::NPN_SetException):
Call NetscapePlugin::setException.
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::setException):
Call NPRuntimeObjectMap::setGlobalException.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64449 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 1e1a741..7ec10a5 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,36 @@
+2010-08-01 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Implement NPN_SetException
+ https://bugs.webkit.org/show_bug.cgi?id=43320
+
+ * WebProcess/Plugins/JSNPObject.cpp:
+ (WebKit::JSNPObject::callConstructor):
+ (WebKit::JSNPObject::put):
+ (WebKit::JSNPObject::getOwnPropertyNames):
+ (WebKit::JSNPObject::propertyGetter):
+ Call NPRuntimeObjectMap::moveGlobalExceptionToExecState.
+
+ * WebProcess/Plugins/NPRuntimeObjectMap.cpp:
+ (WebKit::globalExceptionString):
+ Add static global.
+
+ (WebKit::NPRuntimeObjectMap::setGlobalException):
+ Set the global exception string.
+
+ (WebKit::NPRuntimeObjectMap::moveGlobalExceptionToExecState):
+ Create an error from the exception string.
+
+ * WebProcess/Plugins/NPRuntimeObjectMap.h:
+ * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+ (WebKit::NPN_SetException):
+ Call NetscapePlugin::setException.
+
+ * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
+ (WebKit::NetscapePlugin::setException):
+ Call NPRuntimeObjectMap::setGlobalException.
+
2010-08-01 Sam Weinig <sam at webkit.org>
Roll r64446 out. It broke the test runner.
diff --git a/WebKit2/WebProcess/Plugins/JSNPObject.cpp b/WebKit2/WebProcess/Plugins/JSNPObject.cpp
index 18d0f27..56df30f 100644
--- a/WebKit2/WebProcess/Plugins/JSNPObject.cpp
+++ b/WebKit2/WebProcess/Plugins/JSNPObject.cpp
@@ -151,8 +151,8 @@ JSValue JSNPObject::callConstructor(ExecState* exec)
{
JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);
returnValue = m_npObject->_class->construct(m_npObject, arguments.data(), argumentCount, &result);
-
- // FIXME: Handle construct setting an exception.
+ NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec);
+
// FIXME: Find out what happens if calling construct causes the plug-in to go away.
}
@@ -273,7 +273,8 @@ void JSNPObject::put(ExecState* exec, const Identifier& propertyName, JSValue va
JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);
m_npObject->_class->setProperty(m_npObject, npIdentifier, &variant);
- // FIXME: Handle setProperty setting an exception.
+ NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec);
+
// FIXME: Find out what happens if calling setProperty causes the plug-in to go away.
// FIXME: Should we throw an exception if setProperty returns false?
}
@@ -297,11 +298,12 @@ void JSNPObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propert
{
JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);
- // FIXME: Handle enumerate setting an exception.
// FIXME: Find out what happens if calling enumerate causes the plug-in to go away.
// FIXME: Should we throw an exception if enumerate returns false?
if (!m_npObject->_class->enumerate(m_npObject, &identifiers, &identifierCount))
return;
+
+ NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec);
}
for (uint32_t i = 0; i < identifierCount; ++i) {
@@ -342,7 +344,8 @@ JSValue JSNPObject::propertyGetter(ExecState* exec, JSValue slotBase, const Iden
NPIdentifier npIdentifier = npIdentifierFromIdentifier(propertyName);
returnValue = thisObj->m_npObject->_class->getProperty(thisObj->m_npObject, npIdentifier, &result);
- // FIXME: Handle getProperty setting an exception.
+ NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec);
+
// FIXME: Find out what happens if calling getProperty causes the plug-in to go away.
}
diff --git a/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp b/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp
index bb28163..e1ac9ef 100644
--- a/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp
+++ b/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp
@@ -30,6 +30,7 @@
#include "NPRuntimeUtilities.h"
#include "NotImplemented.h"
#include "PluginView.h"
+#include <JavaScriptCore/Error.h>
#include <JavaScriptCore/JSLock.h>
#include <JavaScriptCore/SourceCode.h>
#include <WebCore/Frame.h>
@@ -234,4 +235,28 @@ ExecState* NPRuntimeObjectMap::globalExec() const
return globalObject->globalExec();
}
+static String& globalExceptionString()
+{
+ DEFINE_STATIC_LOCAL(String, exceptionString, ());
+ return exceptionString;
+}
+
+void NPRuntimeObjectMap::setGlobalException(const String& exceptionString)
+{
+ globalExceptionString() = exceptionString;
+}
+
+void NPRuntimeObjectMap::moveGlobalExceptionToExecState(ExecState* exec)
+{
+ if (globalExceptionString().isNull())
+ return;
+
+ {
+ JSLock lock(SilenceAssertionsOnly);
+ throwError(exec, createError(exec, stringToUString(globalExceptionString())));
+ }
+
+ globalExceptionString() = String();
+}
+
} // namespace WebKit
diff --git a/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.h b/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.h
index cb530b9..ed064a6 100644
--- a/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.h
+++ b/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.h
@@ -65,7 +65,7 @@ public:
void convertJSValueToNPVariant(JSC::ExecState*, JSC::JSValue, NPVariant&);
JSC::JSValue convertNPVariantToJSValue(JSC::ExecState*, JSC::JSGlobalObject*, const NPVariant&);
- bool evaluate(NPObject*, const WebCore::String&scriptString, NPVariant* result);
+ bool evaluate(NPObject*, const WebCore::String& scriptString, NPVariant* result);
// Called when the plug-in is destroyed. Will invalidate all the NPObjects.
void invalidate();
@@ -73,6 +73,9 @@ public:
JSC::JSGlobalObject* globalObject() const;
JSC::ExecState* globalExec() const;
+ static void setGlobalException(const WebCore::String& exceptionString);
+ static void moveGlobalExceptionToExecState(JSC::ExecState*);
+
private:
PluginView* m_pluginView;
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
index 3a77805..b7a3e22 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
@@ -619,9 +619,9 @@ static void NPN_ReleaseVariantValue(NPVariant* variant)
releaseNPVariantValue(variant);
}
-static void NPN_SetException(NPObject* npobj, const NPUTF8* message)
+static void NPN_SetException(NPObject*, const NPUTF8* message)
{
- notImplemented();
+ NetscapePlugin::setException(message);
}
static void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled)
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
index e209ce2..eea5fc1 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
@@ -25,6 +25,7 @@
#include "NetscapePlugin.h"
+#include "NPRuntimeObjectMap.h"
#include "NetscapePluginStream.h"
#include "PluginController.h"
#include <WebCore/GraphicsContext.h>
@@ -148,6 +149,13 @@ void NetscapePlugin::setStatusbarText(const String& statusbarText)
m_pluginController->setStatusbarText(statusbarText);
}
+void NetscapePlugin::setException(const String& exceptionString)
+{
+ // FIXME: If the plug-in is running in its own process, this needs to send a CoreIPC message instead of
+ // calling the runtime object map directly.
+ NPRuntimeObjectMap::setGlobalException(exceptionString);
+}
+
bool NetscapePlugin::evaluate(NPObject* npObject, const String& scriptString, NPVariant* result)
{
return m_pluginController->evaluate(npObject, scriptString, result, allowPopups());
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
index eda7b9d..6516c0e 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
@@ -60,6 +60,7 @@ public:
const Vector<char>& httpBody, bool sendNotification, void* notificationData);
NPError destroyStream(NPStream*, NPReason);
void setStatusbarText(const WebCore::String&);
+ static void setException(const WebCore::String&);
bool evaluate(NPObject*, const WebCore::String&scriptString, NPVariant* result);
// These return retained objects.
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list