[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

eric at webkit.org eric at webkit.org
Thu Oct 29 20:47:54 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit a2d2873ae4865a838f86d553e3cccbe722197e35
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 19 18:50:26 2009 +0000

    2009-10-19  Nate Chapin  <japhet at chromium.org>
    
            Reviewed by Adam Barth.
    
            Test that the proper exception is thrown into JS when a plugin
            invoke call returns false.
    
            https://bugs.webkit.org/show_bug.cgi?id=30239
    
            * plugins/netscape-invoke-failure-expected.txt: Added.
            * plugins/netscape-invoke-failure.html: Added.
    2009-10-19  Nate Chapin  <japhet at chromium.org>
    
            Reviewed by Adam Barth.
    
            If a call to a plugin's invokeMethod, invokeDefault or construct
            returns false, throw an exception into JS.
    
            https://bugs.webkit.org/show_bug.cgi?id=30239
    
            Test: plugins/netscape-invoke-failure.html
    
            * bindings/v8/V8NPObject.cpp: Check return values of invokeMethod, invokeDefault and construct.
            (npObjectInvokeImpl):
            * bridge/c/c_instance.cpp:
            (JSC::Bindings::CInstance::invokeMethod): Check return value
            (JSC::Bindings::CInstance::invokeDefaultMethod): Check return value
            (JSC::Bindings::CInstance::invokeConstruct): Check return value
    2009-10-19  Nate Chapin  <japhet at chromium.org>
    
            Reviewed by Adam Barth.
    
            Add testFail() to test plugin so we can test our handling of a
            plugin invoke call returning false.
    
            https://bugs.webkit.org/show_bug.cgi?id=30239
    
            * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp: Add testFail().
            (pluginInvoke):
            (testIdentifierToString): Always return true, since returning false will now cause an exception to be thrown.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49796 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e36ab24..56d3fc1 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2009-10-19  Nate Chapin  <japhet at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Test that the proper exception is thrown into JS when a plugin
+        invoke call returns false.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30239
+
+        * plugins/netscape-invoke-failure-expected.txt: Added.
+        * plugins/netscape-invoke-failure.html: Added.
+
 2009-10-16  Stephen White  <senorblanco at chromium.org>
 
         Reviewed by Adam Barth.
diff --git a/LayoutTests/plugins/netscape-invoke-failure-expected.txt b/LayoutTests/plugins/netscape-invoke-failure-expected.txt
new file mode 100644
index 0000000..d996eeb
--- /dev/null
+++ b/LayoutTests/plugins/netscape-invoke-failure-expected.txt
@@ -0,0 +1,2 @@
+
+SUCCESS: Exception caught: Error: Error calling method on NPObject!
diff --git a/LayoutTests/plugins/netscape-invoke-failure.html b/LayoutTests/plugins/netscape-invoke-failure.html
new file mode 100644
index 0000000..007b453
--- /dev/null
+++ b/LayoutTests/plugins/netscape-invoke-failure.html
@@ -0,0 +1,13 @@
+<html><body>
+<embed name="plg" type="application/x-webkit-test-netscape"></embed>
+<div id="console">FAILURE: No exception caught.</div>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    try {
+        plg.testFail();
+    } catch (e) {
+        document.getElementById('console').innerHTML = 'SUCCESS: Exception caught: ' + e;
+    }
+</script></body></html>
\ No newline at end of file
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 307fa54..7e62c69 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2009-10-19  Nate Chapin  <japhet at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        If a call to a plugin's invokeMethod, invokeDefault or construct
+        returns false, throw an exception into JS.        
+
+        https://bugs.webkit.org/show_bug.cgi?id=30239
+
+        Test: plugins/netscape-invoke-failure.html
+
+        * bindings/v8/V8NPObject.cpp: Check return values of invokeMethod, invokeDefault and construct.
+        (npObjectInvokeImpl):
+        * bridge/c/c_instance.cpp:
+        (JSC::Bindings::CInstance::invokeMethod): Check return value
+        (JSC::Bindings::CInstance::invokeDefaultMethod): Check return value
+        (JSC::Bindings::CInstance::invokeConstruct): Check return value
+
 2009-10-16  Stephen White  <senorblanco at chromium.org>
 
         Reviewed by Adam Barth.
diff --git a/WebCore/bindings/v8/V8NPObject.cpp b/WebCore/bindings/v8/V8NPObject.cpp
index b6bf0f7..75163f1 100644
--- a/WebCore/bindings/v8/V8NPObject.cpp
+++ b/WebCore/bindings/v8/V8NPObject.cpp
@@ -93,26 +93,30 @@ static v8::Handle<v8::Value> npObjectInvokeImpl(const v8::Arguments& args, Invok
     NPVariant result;
     VOID_TO_NPVARIANT(result);
 
+    bool retval = true;
     switch (functionId) {
     case InvokeMethod:
         if (npObject->_class->invoke) {
             v8::Handle<v8::String> functionName(v8::String::Cast(*args.Data()));
             NPIdentifier identifier = getStringIdentifier(functionName);
-            npObject->_class->invoke(npObject, identifier, npArgs.get(), numArgs, &result);
+            retval = npObject->_class->invoke(npObject, identifier, npArgs.get(), numArgs, &result);
         }
         break;
     case InvokeConstruct:
         if (npObject->_class->construct)
-            npObject->_class->construct(npObject, npArgs.get(), numArgs, &result);
+            retval = npObject->_class->construct(npObject, npArgs.get(), numArgs, &result);
         break;
     case InvokeDefault:
         if (npObject->_class->invokeDefault)
-            npObject->_class->invokeDefault(npObject, npArgs.get(), numArgs, &result);
+            retval = npObject->_class->invokeDefault(npObject, npArgs.get(), numArgs, &result);
         break;
     default:
         break;
     }
 
+    if (!retval)
+        throwError("Error calling method on NPObject!", V8Proxy::GeneralError);
+
     for (int i=0; i < numArgs; i++)
         _NPN_ReleaseVariantValue(&npArgs[i]);
 
diff --git a/WebCore/bridge/c/c_instance.cpp b/WebCore/bridge/c/c_instance.cpp
index fcdd166..77b5966 100644
--- a/WebCore/bridge/c/c_instance.cpp
+++ b/WebCore/bridge/c/c_instance.cpp
@@ -121,15 +121,19 @@ JSValue CInstance::invokeMethod(ExecState* exec, const MethodList& methodList, c
         convertValueToNPVariant(exec, args.at(i), &cArgs[i]);
 
     // Invoke the 'C' method.
+    bool retval = true;
     NPVariant resultVariant;
     VOID_TO_NPVARIANT(resultVariant);
 
     {
         JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);
         ASSERT(globalExceptionString().isNull());
-        _object->_class->invoke(_object, ident, cArgs.data(), count, &resultVariant);
+        retval = _object->_class->invoke(_object, ident, cArgs.data(), count, &resultVariant);
         moveGlobalExceptionToExecState(exec);
     }
+    
+    if (!retval)
+        throwError(exec, GeneralError, "Error calling method on NPObject!");
 
     for (i = 0; i < count; i++)
         _NPN_ReleaseVariantValue(&cArgs[i]);
@@ -153,14 +157,18 @@ JSValue CInstance::invokeDefaultMethod(ExecState* exec, const ArgList& args)
         convertValueToNPVariant(exec, args.at(i), &cArgs[i]);
 
     // Invoke the 'C' method.
+    bool retval = true;
     NPVariant resultVariant;
     VOID_TO_NPVARIANT(resultVariant);
     {
         JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);
         ASSERT(globalExceptionString().isNull());
-        _object->_class->invokeDefault(_object, cArgs.data(), count, &resultVariant);
+        retval = _object->_class->invokeDefault(_object, cArgs.data(), count, &resultVariant);
         moveGlobalExceptionToExecState(exec);
     }
+    
+    if (!retval)
+        throwError(exec, GeneralError, "Error calling method on NPObject!");
 
     for (i = 0; i < count; i++)
         _NPN_ReleaseVariantValue(&cArgs[i]);
@@ -188,14 +196,18 @@ JSValue CInstance::invokeConstruct(ExecState* exec, const ArgList& args)
         convertValueToNPVariant(exec, args.at(i), &cArgs[i]);
 
     // Invoke the 'C' method.
+    bool retval = true;
     NPVariant resultVariant;
     VOID_TO_NPVARIANT(resultVariant);
     {
         JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);
         ASSERT(globalExceptionString().isNull());
-        _object->_class->construct(_object, cArgs.data(), count, &resultVariant);
+        retval = _object->_class->construct(_object, cArgs.data(), count, &resultVariant);
         moveGlobalExceptionToExecState(exec);
     }
+    
+    if (!retval)
+        throwError(exec, GeneralError, "Error calling method on NPObject!");
 
     for (i = 0; i < count; i++)
         _NPN_ReleaseVariantValue(&cArgs[i]);
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 3ed8cd2..8942aeb 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,16 @@
+2009-10-19  Nate Chapin  <japhet at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Add testFail() to test plugin so we can test our handling of a
+        plugin invoke call returning false.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30239
+
+        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp: Add testFail().
+        (pluginInvoke):
+        (testIdentifierToString): Always return true, since returning false will now cause an exception to be thrown.
+
 2009-10-19  Zan Dobersek  <zandobersek at gmail.com>
 
         Reviewed by Gustavo Noronha.
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
index 8a61bb6..14280ba 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
@@ -150,6 +150,7 @@ enum {
     ID_TEST_POSTURL_FILE,
     ID_TEST_CONSTRUCT,
     ID_TEST_THROW_EXCEPTION_METHOD,
+    ID_TEST_FAIL_METHOD,
     ID_DESTROY_NULL_STREAM,
     NUM_METHOD_IDENTIFIERS
 };
@@ -175,6 +176,7 @@ static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
     "testPostURLFile",
     "testConstruct",
     "testThrowException",
+    "testFail",
     "destroyNullStream"
 };
 
@@ -323,13 +325,13 @@ static NPIdentifier variantToIdentifier(NPVariant variant)
 static bool testIdentifierToString(PluginObject*, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
     if (argCount != 1)
-        return false;
+        return true;
     NPIdentifier identifier = variantToIdentifier(args[0]);
     if (!identifier)
-        return false;
+        return true;
     NPUTF8* utf8String = browser->utf8fromidentifier(identifier);
     if (!utf8String)
-        return false;
+        return true;
     STRINGZ_TO_NPVARIANT(utf8String, *result);
     return true;
 }
@@ -683,6 +685,10 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
     else if (name == pluginMethodIdentifiers[ID_TEST_THROW_EXCEPTION_METHOD]) {
         browser->setexception(header, "plugin object testThrowException SUCCESS");
         return true;
+    } else if (name == pluginMethodIdentifiers[ID_TEST_FAIL_METHOD]) {
+        NPObject* windowScriptObject;
+        browser->getvalue(plugin->npp, NPNVWindowNPObject, &windowScriptObject);
+        browser->invoke(plugin->npp, windowScriptObject, name, args, argCount, result);
     } else if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM]) 
         return destroyNullStream(plugin, args, argCount, result);
     

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list