Commit b7678630 authored by aroben@apple.com's avatar aroben@apple.com

Don't notify the plugin when a targeted javascript: URL request completes

This matches Mozilla and WebKit1.

Fixes <http://webkit.org/b/60568> <rdar://problem/8610657> REGRESSION (WebKit2): Flash
plugin doesn't appear on a hanes.com page

Test: plugins/get-targeted-javascript-url.html

Reviewed by Anders Carlsson.

Source/WebKit2:

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::performJavaScriptURLRequest): Don't call back to the plugin if the
request had a target.

LayoutTests:

Test what happens when a plugin makes a targeted javascript: request

* plugins/get-targeted-javascript-url-expected.txt: Added.
* plugins/get-targeted-javascript-url.html: Added.
(startTest): Tell the plugin to make two targeted javascript: requests. One calls a function
with a return value, the other calls a function with no return value.
(finishTest): Check that both functions were called, and that we either didn't get an
NPP_URLNotify call (like in Mozilla, WebKit1, and WebKit2), or got an NPP_URLNotify call
with NPRES_DONE (like in Chrome).

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86259 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 272229c9
2011-05-11 Adam Roben <aroben@apple.com>
Test what happens when a plugin makes a targeted javascript: request
Test for <http://webkit.org/b/60568> <rdar://problem/8610657> REGRESSION (WebKit2): Flash
plugin doesn't appear on a hanes.com page
Reviewed by Anders Carlsson.
* plugins/get-targeted-javascript-url-expected.txt: Added.
* plugins/get-targeted-javascript-url.html: Added.
(startTest): Tell the plugin to make two targeted javascript: requests. One calls a function
with a return value, the other calls a function with no return value.
(finishTest): Check that both functions were called, and that we either didn't get an
NPP_URLNotify call (like in Mozilla, WebKit1, and WebKit2), or got an NPP_URLNotify call
with NPRES_DONE (like in Chrome).
2011-05-11 Kenji Imasaki <imasaki@chromium.org>
Reviewed by David Levin.
Test for Bug 60568: REGRESSION (WebKit2): Flash plugin doesn't appear on a hanes.com page.
SUCCESS (no return value): NPP_URLNotify was not called, or was called with a reason of NPRES_DONE
SUCCESS (return value): NPP_URLNotify was not called, or was called with a reason of NPRES_DONE
<!DOCTYPE html>
<html>
<head>
<script>
addEventListener('load', startTest, false);
var noReturnValueFunctionCalled = false;
var returnValueFunctionCalled = false;
var noReturnValueReason = -1;
var returnValueReason = -1;
function startTest() {
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
var plugin = document.getElementsByTagName('embed')[0];
plugin.getURLNotify('javascript:noReturnValueFunction()', '_self', 'noReturnValueURLNotify');
plugin.getURLNotify('javascript:returnValueFunction()', '_self', 'returnValueURLNotify');
// The javascript: URLs will be evaluated asynchronously. Since we don't expect a
// callback when the evaluation is complete, we have to use a lame timeout to give
// the callback time to be evaluated.
setTimeout(finishTest, 250);
}
function finishTest() {
if (!noReturnValueFunctionCalled)
log('FAIL: noReturnValueFunction was not called');
else if (noReturnValueReason !== -1 && noReturnValueReason !== 0)
log('FAIL (no return value): NPP_URLNotify called with unexpected reason ' + noReturnValueReason);
else
log('SUCCESS (no return value): NPP_URLNotify was not called, or was called with a reason of NPRES_DONE');
if (!returnValueFunctionCalled)
log('FAIL: returnValueFunction was not called');
else if (returnValueReason !== -1 && returnValueReason !== 0)
log('FAIL (return value): NPP_URLNotify called with unexpected reason ' + returnValueReason);
else
log('SUCCESS (return value): NPP_URLNotify was not called, or was called with a reason of NPRES_DONE');
if (window.layoutTestController)
layoutTestController.notifyDone();
}
function log(msg) {
document.getElementById('log').appendChild(document.createTextNode(msg + '\n'));
}
function noReturnValueFunction() {
noReturnValueFunctionCalled = true;
}
function returnValueFunction() {
returnValueFunctionCalled = true;
return 'foo';
}
function noReturnValueURLNotify(reason) {
noReturnValueReason = reason;
}
function returnValueURLNotify(reason) {
returnValueReason = reason;
}
</script>
</head>
<body>
<embed type="application/x-webkit-test-netscape"></embed>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=60568">Bug 60568: REGRESSION (WebKit2): Flash plugin doesn't appear on a hanes.com page</a>.</p>
<pre id="log"></pre>
</body>
</html>
2011-05-11 Adam Roben <aroben@apple.com>
Don't notify the plugin when a targeted javascript: URL request completes
This matches Mozilla and WebKit1.
Fixes <http://webkit.org/b/60568> <rdar://problem/8610657> REGRESSION (WebKit2): Flash
plugin doesn't appear on a hanes.com page
Test: plugins/get-targeted-javascript-url.html
Reviewed by Anders Carlsson.
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::performJavaScriptURLRequest): Don't call back to the plugin if the
request had a target.
2011-05-11 Jessie Berlin <jberlin@apple.com>
Reviewed by Steve Falkenburg.
......
......@@ -781,19 +781,14 @@ void PluginView::performJavaScriptURLRequest(URLRequest* request)
if (!plugin->controller())
return;
// Don't notify the plug-in at all about targeted javascript: requests. This matches Mozilla and WebKit1.
if (!request->target().isNull())
return;
ScriptState* scriptState = frame->script()->globalObject(pluginWorld())->globalExec();
String resultString;
result.getString(scriptState, resultString);
if (!request->target().isNull()) {
// Just send back whether the frame load succeeded or not.
if (resultString.isNull())
m_plugin->frameDidFail(request->requestID(), false);
else
m_plugin->frameDidFinishLoading(request->requestID());
return;
}
// Send the result back to the plug-in.
plugin->didEvaluateJavaScript(request->requestID(), decodeURLEscapeSequences(request->request().url()), resultString);
}
......
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