Commit 526c36f0 authored by andersca's avatar andersca

LayoutTests:

        Reviewed by Adam, Darin.

        <rdar://problem/5025212>
        In Mail, a crash occurs at WebCore::Frame::tree() when clicking on embedded flash object

        * plugins/get-url-with-blank-target-expected.txt: Added.
        * plugins/get-url-with-blank-target.html: Added.

WebKit:

        Reviewed by Adam, Darin.
 
        <rdar://problem/5025212>
        In Mail, a crash occurs at WebCore::Frame::tree() when clicking on embedded flash object

        * Plugins/WebBaseNetscapePluginView.mm:
        (-[WebBaseNetscapePluginView loadPluginRequest:]):
        Handle the case where the web view returned from the delegate method is null. Also, send out an error notification
        in that case so we can catch it.

WebKitTools:

        Reviewed by Adam, Darin.

        <rdar://problem/5025212>
        In Mail, a crash occurs at WebCore::Frame::tree() when clicking on embedded flash object
        
        Add a "getURLNotify" method to the plugin object. This lets you pass a URL, a target and a callback function
        to be run when the URL has finished (or failed) loading.
        
        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.c:
        (pluginInvoke):
        (handleCallback):
        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
        * DumpRenderTree/TestNetscapePlugIn.subproj/main.c:
        (NPP_URLNotify):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@19966 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a27db451
2007-03-05 Anders Carlsson <acarlsson@apple.com>
Reviewed by Adam, Darin.
<rdar://problem/5025212>
In Mail, a crash occurs at WebCore::Frame::tree() when clicking on embedded flash object
* plugins/get-url-with-blank-target-expected.txt: Added.
* plugins/get-url-with-blank-target.html: Added.
2007-03-05 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
This tests that we won't crash when a plugin tries to open an URL in a new window when the application does not create the window. If this test is successful, the text SUCCESS should be seen below.
SUCCESS
<html>
<body>
<embed name="plg" type="application/x-webkit-test-netscape"></embed>
<script>
var NPERR_GENERIC_ERROR = 1;
function callback(result) {
var d = document.getElementById('result');
if (result == NPERR_GENERIC_ERROR)
d.innerHTML = "SUCCESS"
else
d.innerHTML = "FAILED - Expected error code 1 but got error code " + result
layoutTestController.notifyDone();
}
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
plg.getURLNotify("http://www.apple.com", "_blank", "callback");
} else {
document.write("Cannot run interactively");
}
</script>This tests that we won't crash when a plugin tries to open an URL in a new window when the application does not create the window. If this test is successful, the word SUCCESS should be seen below.
<div id="result">FAILED</div>
</body>
</html>
2007-03-05 Anders Carlsson <acarlsson@apple.com>
Reviewed by Adam, Darin.
<rdar://problem/5025212>
In Mail, a crash occurs at WebCore::Frame::tree() when clicking on embedded flash object
* Plugins/WebBaseNetscapePluginView.mm:
(-[WebBaseNetscapePluginView loadPluginRequest:]):
Handle the case where the web view returned from the delegate method is null. Also, send out an error notification
in that case so we can catch it.
2007-03-05 John Sullivan <sullivan@apple.com>
Reviewed by Darin and Kevin D
......
......@@ -1978,6 +1978,16 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
} else {
newWebView = [[WebDefaultUIDelegate sharedUIDelegate] webView:currentWebView createWebViewWithRequest:nil];
}
if (!newWebView) {
if ([pluginRequest sendNotification]) {
[self willCallPlugInFunction];
NPP_URLNotify(plugin, [[[pluginRequest request] URL] _web_URLCString], NPERR_GENERIC_ERROR, [pluginRequest notifyData]);
[self didCallPlugInFunction];
}
return;
}
frame = [newWebView mainFrame];
core(frame)->tree()->setName(frameName);
[[newWebView _UIDelegateForwarder] webViewShow:newWebView];
......
2007-03-05 Anders Carlsson <acarlsson@apple.com>
Reviewed by Adam, Darin.
<rdar://problem/5025212>
In Mail, a crash occurs at WebCore::Frame::tree() when clicking on embedded flash object
Add a "getURLNotify" method to the plugin object. This lets you pass a URL, a target and a callback function
to be run when the URL has finished (or failed) loading.
* DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.c:
(pluginInvoke):
(handleCallback):
* DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
* DumpRenderTree/TestNetscapePlugIn.subproj/main.c:
(NPP_URLNotify):
2007-03-04 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
Reviewed by Nikolas Zimmermann.
......
......@@ -79,15 +79,17 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
#define ID_TEST_GETURL 1
#define ID_REMOVE_DEFAULT_METHOD 2
#define ID_TEST_DOM_ACCESS 3
#define ID_TEST_GET_URL_NOTIFY 4
#define NUM_METHOD_IDENTIFIERS 4
#define NUM_METHOD_IDENTIFIERS 5
static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
"testCallback",
"getURL",
"removeDefaultMethod",
"testDOMAccess"
"testDOMAccess",
"getURLNotify",
};
static NPUTF8* createCStringFromNPVariant(const NPVariant *variant)
......@@ -209,6 +211,22 @@ static bool pluginInvoke(NPObject *header, NPIdentifier name, const NPVariant *a
testDOMAccess(obj);
VOID_TO_NPVARIANT(*result);
return true;
} else if (name == pluginMethodIdentifiers[ID_TEST_GET_URL_NOTIFY]) {
if (argCount == 3 && NPVARIANT_IS_STRING(args[0]) && NPVARIANT_IS_STRING(args[1]) && NPVARIANT_IS_STRING(args[2])) {
NPUTF8* urlString = createCStringFromNPVariant(&args[0]);
NPUTF8* targetString = createCStringFromNPVariant(&args[1]);
NPUTF8* callbackString = createCStringFromNPVariant(&args[2]);
NPIdentifier callbackIdentifier = browser->getstringidentifier(callbackString);
browser->geturlnotify(obj->npp, urlString, targetString, callbackIdentifier);
free(urlString);
free(targetString);
free(callbackString);
VOID_TO_NPVARIANT(*result);
return true;
}
}
return false;
......@@ -244,3 +262,21 @@ static void pluginDeallocate(NPObject *obj)
{
free(obj);
}
void handleCallback(PluginObject* object, const char *url, NPReason reason, void *notifyData)
{
assert(object);
NPVariant args[1];
NPObject *windowScriptObject;
browser->getvalue(object->npp, NPPVpluginScriptableNPObject, &windowScriptObject);
NPIdentifier callbackIdentifier = notifyData;
INT32_TO_NPVARIANT(reason, args[0]);
NPVariant browserResult;
browser->invoke(object->npp, windowScriptObject, callbackIdentifier, args, 1, &browserResult);
browser->releasevariantvalue(&browserResult);
}
......@@ -42,3 +42,4 @@ typedef struct {
} PluginObject;
extern NPClass *getPluginClass(void);
extern void handleCallback(PluginObject* object, const char *url, NPReason reason, void *notifyData);
......@@ -192,6 +192,9 @@ int16 NPP_HandleEvent(NPP instance, void *event)
void NPP_URLNotify(NPP instance, const char *url, NPReason reason, void *notifyData)
{
PluginObject *obj = instance->pdata;
handleCallback(obj, url, reason, notifyData);
}
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment