[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373
eric at webkit.org
eric at webkit.org
Wed Apr 7 23:25:14 UTC 2010
The following commit has been merged in the webkit-1.2 branch:
commit b9d542f939896baf9c1b5415366e4c9116967fd4
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Nov 6 23:00:44 2009 +0000
2009-11-06 Anantanarayanan G Iyengar <ananta at chromium.org>
Reviewed by Adam Barth.
Added layout tests to test document.open and window.open calls issued
by NPAPI plugins without a calling javascript context. The associated
webkit bug is https://bugs.webkit.org/show_bug.cgi?id=31067, which
affects Chromium.
* plugins/document-open-expected.txt: Added.
* plugins/document-open.html: Added.
* plugins/window-open-expected.txt: Added.
* plugins/window-open.html: Added.
2009-11-06 Anantanarayanan G Iyengar <ananta at chromium.org>
Reviewed by Adam Barth.
The associated webkit bug is https://bugs.webkit.org/show_bug.cgi?id=31067,
which affects Chromium only.
Changes to V8HTMLDocumentCustom.cpp are as below:-
1. The HTMLDocumentOpen function would cause a crash in Chromium if
there was no calling javascript context. We now check for this case
and pass in NULL to the HTMLDocument::open function which can handle
a NULL document parameter.
2. The other functions like HTMLDocumentWrite, HTMLDocumentWriteln, etc
had ASSERTS for a NULL caller frame, which was bogus as it would crash
anyway. We now check for this case and return a failure.
Changes to V8DOMWindowCustom.cpp are as below:-
1. Instead of failing the window.open call made by NPAPI for lack of a
calling javascript context, we now use the entered context as the calling
context.
Tests: plugins/document-open.html
plugins/window-open.html
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::CALLBACK_FUNC_DECL):
* bindings/v8/custom/V8HTMLDocumentCustom.cpp:
(WebCore::CALLBACK_FUNC_DECL):
2009-11-06 Anantanarayanan G Iyengar <ananta at chromium.org>
Reviewed by Adam Barth.
Added functionality to the layout test plugin to invoke document.open and
window.open with default arguments. The associated webkit bug is
https://bugs.webkit.org/show_bug.cgi?id=31067, which affects Chromium. Basically
window.open and document.open calls issued by NPAPI plugins via NPN_Invoke don't
work in Chromium (V8) if there is no calling javascript context. To achieve this
effect we invoke these functions in the layout test plugin in the NPP_SetWindow
for the window.open test case and in NPP_DestroyStream for the document.open test case.
* DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp:
(testDocumentOpen):
(testWindowOpen):
(pluginAllocate):
* DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
* DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp:
(NPP_New):
(NPP_SetWindow):
(NPP_DestroyStream):
* DumpRenderTree/win/TestNetscapePlugin/main.cpp:
(NPP_New):
(NPP_SetWindow):
(NPP_NewStream):
(NPP_DestroyStream):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50607 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 484f397..74fd877 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2009-11-06 Anantanarayanan G Iyengar <ananta at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Added layout tests to test document.open and window.open calls issued
+ by NPAPI plugins without a calling javascript context. The associated
+ webkit bug is https://bugs.webkit.org/show_bug.cgi?id=31067, which
+ affects Chromium.
+
+ * plugins/document-open-expected.txt: Added.
+ * plugins/document-open.html: Added.
+ * plugins/window-open-expected.txt: Added.
+ * plugins/window-open.html: Added.
+
2009-11-06 Steve Block <steveblock at google.com>
Reviewed by Eric Seidel.
diff --git a/LayoutTests/plugins/document-open-expected.txt b/LayoutTests/plugins/document-open-expected.txt
new file mode 100644
index 0000000..3e0508b
--- /dev/null
+++ b/LayoutTests/plugins/document-open-expected.txt
@@ -0,0 +1 @@
+CONSOLE MESSAGE: line 0: PLUGIN: DOCUMENT OPEN SUCCESS
diff --git a/LayoutTests/plugins/document-open.html b/LayoutTests/plugins/document-open.html
new file mode 100644
index 0000000..ea7ff0d
--- /dev/null
+++ b/LayoutTests/plugins/document-open.html
@@ -0,0 +1,22 @@
+<html>
+<head>
+<body>
+<embed id="testPlugin"
+ type="application/x-webkit-test-netscape"
+ src="data:text/plain,"
+ testdocumentopenindestroystream="true">
+</embed>
+
+<div>
+ This tests that document.open invoked by a plugin via NPN_Invoke without a javascript context succeeds.
+</div>
+<script>
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ // If we are not done within 50 ms then we assume that the test failed.
+ setTimeout('layoutTestController.notifyDone()', 50);
+ }
+</script>
+</body>
+</html>
diff --git a/LayoutTests/plugins/window-open-expected.txt b/LayoutTests/plugins/window-open-expected.txt
new file mode 100644
index 0000000..2f47781
--- /dev/null
+++ b/LayoutTests/plugins/window-open-expected.txt
@@ -0,0 +1,3 @@
+CONSOLE MESSAGE: line 0: PLUGIN: WINDOW OPEN SUCCESS
+
+This tests that window.open invoked by a plugin via NPN_Invoke without a javascript context succeeds.
diff --git a/LayoutTests/plugins/window-open.html b/LayoutTests/plugins/window-open.html
new file mode 100644
index 0000000..aedef2d
--- /dev/null
+++ b/LayoutTests/plugins/window-open.html
@@ -0,0 +1,21 @@
+<html>
+<head>
+<script>
+ if (window.layoutTestController) {
+ layoutTestController.setCanOpenWindows();
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+
+ // If we are not done within 50 ms then we assume that the test failed.
+ setTimeout('layoutTestController.notifyDone()', 50);
+ }
+
+</script>
+<body style="margin:0px;overflow:hidden">
+<object name="testPlugin" type="application/x-webkit-test-netscape" testwindowopen="true">
+</object>
+<div>
+ This tests that window.open invoked by a plugin via NPN_Invoke without a javascript context succeeds.
+</div>
+<body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1176c0a..204b087 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,32 @@
+2009-11-06 Anantanarayanan G Iyengar <ananta at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ The associated webkit bug is https://bugs.webkit.org/show_bug.cgi?id=31067,
+ which affects Chromium only.
+
+ Changes to V8HTMLDocumentCustom.cpp are as below:-
+ 1. The HTMLDocumentOpen function would cause a crash in Chromium if
+ there was no calling javascript context. We now check for this case
+ and pass in NULL to the HTMLDocument::open function which can handle
+ a NULL document parameter.
+ 2. The other functions like HTMLDocumentWrite, HTMLDocumentWriteln, etc
+ had ASSERTS for a NULL caller frame, which was bogus as it would crash
+ anyway. We now check for this case and return a failure.
+
+ Changes to V8DOMWindowCustom.cpp are as below:-
+ 1. Instead of failing the window.open call made by NPAPI for lack of a
+ calling javascript context, we now use the entered context as the calling
+ context.
+
+ Tests: plugins/document-open.html
+ plugins/window-open.html
+
+ * bindings/v8/custom/V8DOMWindowCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+ * bindings/v8/custom/V8HTMLDocumentCustom.cpp:
+ (WebCore::CALLBACK_FUNC_DECL):
+
2009-11-06 Steve Block <steveblock at google.com>
Reviewed by Eric Seidel.
diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
index 2d86c34..7106971 100644
--- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
@@ -702,14 +702,15 @@ CALLBACK_FUNC_DECL(DOMWindowOpen)
if (!V8Proxy::canAccessFrame(frame, true))
return v8::Undefined();
- Frame* callingFrame = V8Proxy::retrieveFrameForCallingContext();
- if (!callingFrame)
- return v8::Undefined();
-
Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
if (!enteredFrame)
return v8::Undefined();
+ Frame* callingFrame = V8Proxy::retrieveFrameForCallingContext();
+ // We may not have a calling context if we are invoked by a plugin via NPAPI.
+ if (!callingFrame)
+ callingFrame = enteredFrame;
+
Page* page = frame->page();
if (!page)
return v8::Undefined();
diff --git a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
index afc9ed1..9cf2f3d 100644
--- a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
@@ -120,8 +120,7 @@ CALLBACK_FUNC_DECL(HTMLDocumentWrite)
INC_STATS("DOM.HTMLDocument.write()");
HTMLDocument* htmlDocument = V8DOMWrapper::convertDOMWrapperToNode<HTMLDocument>(args.Holder());
Frame* frame = V8Proxy::retrieveFrameForCallingContext();
- ASSERT(frame);
- htmlDocument->write(writeHelperGetString(args), frame->document());
+ htmlDocument->write(writeHelperGetString(args), frame ? frame->document() : NULL);
return v8::Undefined();
}
@@ -130,8 +129,7 @@ CALLBACK_FUNC_DECL(HTMLDocumentWriteln)
INC_STATS("DOM.HTMLDocument.writeln()");
HTMLDocument* htmlDocument = V8DOMWrapper::convertDOMWrapperToNode<HTMLDocument>(args.Holder());
Frame* frame = V8Proxy::retrieveFrameForCallingContext();
- ASSERT(frame);
- htmlDocument->writeln(writeHelperGetString(args), frame->document());
+ htmlDocument->writeln(writeHelperGetString(args), frame ? frame->document() : NULL);
return v8::Undefined();
}
@@ -170,7 +168,7 @@ CALLBACK_FUNC_DECL(HTMLDocumentOpen)
}
Frame* frame = V8Proxy::retrieveFrameForCallingContext();
- htmlDocument->open(frame->document());
+ htmlDocument->open(frame ? frame->document() : NULL);
// Return the document.
return args.Holder();
}
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index d565402..daf1ade 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,30 @@
+2009-11-06 Anantanarayanan G Iyengar <ananta at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Added functionality to the layout test plugin to invoke document.open and
+ window.open with default arguments. The associated webkit bug is
+ https://bugs.webkit.org/show_bug.cgi?id=31067, which affects Chromium. Basically
+ window.open and document.open calls issued by NPAPI plugins via NPN_Invoke don't
+ work in Chromium (V8) if there is no calling javascript context. To achieve this
+ effect we invoke these functions in the layout test plugin in the NPP_SetWindow
+ for the window.open test case and in NPP_DestroyStream for the document.open test case.
+
+ * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp:
+ (testDocumentOpen):
+ (testWindowOpen):
+ (pluginAllocate):
+ * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
+ * DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp:
+ (NPP_New):
+ (NPP_SetWindow):
+ (NPP_DestroyStream):
+ * DumpRenderTree/win/TestNetscapePlugin/main.cpp:
+ (NPP_New):
+ (NPP_SetWindow):
+ (NPP_NewStream):
+ (NPP_DestroyStream):
+
2009-11-06 Eric Seidel <eric at webkit.org>
Reviewed by Adam Barth.
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
index b98a175..9c2b9d5 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
@@ -643,6 +643,60 @@ static bool testConstruct(PluginObject* obj, const NPVariant* args, uint32_t arg
return browser->construct(obj->npp, NPVARIANT_TO_OBJECT(args[0]), args + 1, argCount - 1, result);
}
+bool testDocumentOpen(NPP npp) {
+ NPIdentifier documentId = browser->getstringidentifier("document");
+ NPIdentifier openId = browser->getstringidentifier("open");
+
+ NPObject *windowObject = NULL;
+ browser->getvalue(npp, NPNVWindowNPObject, &windowObject);
+ if (!windowObject)
+ return false;
+
+ NPVariant docVariant;
+ browser->getproperty(npp, windowObject, documentId, &docVariant);
+ if (docVariant.type != NPVariantType_Object)
+ return false;
+
+ NPObject *documentObject = NPVARIANT_TO_OBJECT(docVariant);
+
+ NPVariant openArgs[2];
+ STRINGZ_TO_NPVARIANT("text/html", openArgs[0]);
+ STRINGZ_TO_NPVARIANT("_blank", openArgs[1]);
+
+ NPVariant result;
+ browser->invoke(npp, documentObject, openId, openArgs, 2, &result);
+ browser->releaseobject(documentObject);
+
+ if (result.type == NPVariantType_Object) {
+ browser->releaseobject(result.value.objectValue);
+ pluginLog(npp, "DOCUMENT OPEN SUCCESS");
+ return true;
+ }
+ return false;
+}
+
+bool testWindowOpen(NPP npp) {
+ NPIdentifier openId = browser->getstringidentifier("open");
+
+ NPObject *windowObject = NULL;
+ browser->getvalue(npp, NPNVWindowNPObject, &windowObject);
+ if (!windowObject)
+ return false;
+
+ NPVariant openArgs[2];
+ STRINGZ_TO_NPVARIANT("about:blank", openArgs[0]);
+ STRINGZ_TO_NPVARIANT("_blank", openArgs[1]);
+
+ NPVariant result;
+ browser->invoke(npp, windowObject, openId, openArgs, 2, &result);
+ if (result.type == NPVariantType_Object) {
+ browser->releaseobject(result.value.objectValue);
+ pluginLog(npp, "WINDOW OPEN SUCCESS");
+ return true;
+ }
+ return false;
+}
+
static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
PluginObject* plugin = reinterpret_cast<PluginObject*>(header);
@@ -733,6 +787,9 @@ static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
newInstance->lastUrl = NULL;
newInstance->lastHeaders = NULL;
+ newInstance->testDocumentOpenInDestroyStream = FALSE;
+ newInstance->testWindowOpen = FALSE;
+
return (NPObject*)newInstance;
}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h
index b34d24a..157a1d2 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h
@@ -38,6 +38,8 @@ typedef struct {
NPBool cachedPrivateBrowsingMode;
NPObject* testObject;
NPStream* stream;
+ NPBool testDocumentOpenInDestroyStream;
+ NPBool testWindowOpen;
char* onStreamLoad;
char* onStreamDestroy;
char* onDestroy;
@@ -56,3 +58,5 @@ extern void handleCallback(PluginObject* object, const char *url, NPReason reaso
extern void notifyStream(PluginObject* object, const char *url, const char *headers);
extern void testNPRuntime(NPP npp);
extern void pluginLog(NPP instance, const char* format, ...);
+extern bool testDocumentOpen(NPP npp);
+extern bool testWindowOpen(NPP npp);
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp
index 005e92a..5883ffb 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp
@@ -107,6 +107,10 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
executeScript(obj, "document.body.innerHTML = ''");
else if (!strcasecmp(argn[i], "ondestroy"))
obj->onDestroy = strdup(argv[i]);
+ else if (strcasecmp(argn[i], "testdocumentopenindestroystream") == 0)
+ obj->testDocumentOpenInDestroyStream = TRUE;
+ else if (strcasecmp(argn[i], "testwindowopen") == 0)
+ obj->testWindowOpen = TRUE;
}
#ifndef NP_NO_CARBON
@@ -173,6 +177,11 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window)
pluginLog(instance, "NPP_SetWindow: %d %d", (int)window->width, (int)window->height);
obj->logSetWindow = false;
}
+
+ if (obj->testWindowOpen) {
+ testWindowOpen(instance);
+ obj->testWindowOpen = FALSE;
+ }
}
return NPERR_NO_ERROR;
@@ -217,6 +226,11 @@ NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason)
if (obj->onStreamDestroy)
executeScript(obj, obj->onStreamDestroy);
+ if (obj->testDocumentOpenInDestroyStream) {
+ testDocumentOpen(instance);
+ obj->testDocumentOpenInDestroyStream = FALSE;
+ }
+
return NPERR_NO_ERROR;
}
diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
index 7175d33..82b1d4d 100644
--- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
+++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
@@ -88,12 +88,15 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
for (int i = 0; i < argc; i++)
if (_stricmp(argn[i], "src") == 0)
pluginLog(instance, "src: %s", argv[i]);
- }
+ } else if (_stricmp(argn[i], "testdocumentopenindestroystream") == 0)
+ obj->testDocumentOpenInDestroyStream = TRUE;
+ else if (_stricmp(argn[i], "testwindowopen") == 0)
+ obj->testWindowOpen = TRUE;
}
instance->pdata = obj;
}
-
+
return NPERR_NO_ERROR;
}
@@ -120,6 +123,15 @@ NPError NPP_Destroy(NPP instance, NPSavedData **save)
NPError NPP_SetWindow(NPP instance, NPWindow *window)
{
+ PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
+
+ if (obj) {
+ if (obj->testWindowOpen) {
+ testWindowOpen(instance);
+ obj->testWindowOpen = FALSE;
+ }
+ }
+
return NPERR_NO_ERROR;
}
@@ -149,7 +161,7 @@ NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool se
if (obj->onStreamLoad)
executeScript(obj, obj->onStreamLoad);
-
+
return NPERR_NO_ERROR;
}
@@ -160,6 +172,10 @@ NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason)
if (obj->onStreamDestroy)
executeScript(obj, obj->onStreamDestroy);
+ if (obj->testDocumentOpenInDestroyStream) {
+ testDocumentOpen(instance);
+ }
+
return NPERR_NO_ERROR;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list