summaryrefslogtreecommitdiff
path: root/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp')
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp55
1 files changed, 36 insertions, 19 deletions
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp
index 85cd41d2c..ca9cec8ef 100644
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp
+++ b/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp
@@ -41,10 +41,17 @@ extern "C" void GlobalToLocal(Point*);
using namespace std;
+#if defined(__GNUC__)
+#define CRASH() do { \
+ *(int *)(uintptr_t)0xbbadbeef = 0; \
+ __builtin_trap(); /* More reliable, but doesn't say BBADBEEF. */ \
+} while (false)
+#else
#define CRASH() do { \
*(int *)(uintptr_t)0xbbadbeef = 0; \
((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \
-} while(false)
+} while (false)
+#endif
static bool getEntryPointsWasCalled;
static bool initializeWasCalled;
@@ -116,6 +123,7 @@ NPError STDCALL NP_GetEntryPoints(NPPluginFuncs *pluginFuncs)
pluginFuncs->print = NPP_Print;
pluginFuncs->event = NPP_HandleEvent;
pluginFuncs->urlnotify = NPP_URLNotify;
+ pluginFuncs->urlredirectnotify = NPP_URLRedirectNotify;
pluginFuncs->getvalue = NPP_GetValue;
pluginFuncs->setvalue = NPP_SetValue;
@@ -256,6 +264,8 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc
#endif
} else if (!strcasecmp(argn[i], "src") && strstr(argv[i], "plugin-document-has-focus.pl"))
obj->testKeyboardFocusForPlugins = TRUE;
+ else if (!strcasecmp(argn[i], "src") && strstr(argv[i], "plugin-document-alert-and-notify-done.pl"))
+ executeScript(obj, "alert('Plugin Loaded!'); testRunner.notifyDone();");
else if (!strcasecmp(argn[i], "evaluatescript")) {
char* script = argv[i];
if (script == strstr(script, "mouse::")) {
@@ -348,29 +358,30 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
- if (obj) {
- obj->lastWindow = *window;
+ if (!obj)
+ return NPERR_GENERIC_ERROR;
- if (obj->logSetWindow) {
- pluginLog(instance, "NPP_SetWindow: %d %d", (int)window->width, (int)window->height);
- obj->logSetWindow = FALSE;
- executeScript(obj, "testRunner.notifyDone();");
- }
+ obj->lastWindow = *window;
- if (obj->onSetWindow)
- executeScript(obj, obj->onSetWindow);
+ if (obj->logSetWindow) {
+ pluginLog(instance, "NPP_SetWindow: %d %d", (int)window->width, (int)window->height);
+ obj->logSetWindow = FALSE;
+ executeScript(obj, "testRunner.notifyDone();");
+ }
- if (obj->testWindowOpen) {
- testWindowOpen(instance);
- obj->testWindowOpen = FALSE;
- }
+ if (obj->onSetWindow)
+ executeScript(obj, obj->onSetWindow);
- if (obj->testKeyboardFocusForPlugins) {
- obj->eventLogging = true;
- executeScript(obj, "eventSender.keyDown('A');");
- }
+ if (obj->testWindowOpen) {
+ testWindowOpen(instance);
+ obj->testWindowOpen = FALSE;
}
-
+
+ if (obj->testKeyboardFocusForPlugins) {
+ obj->eventLogging = true;
+ executeScript(obj, "eventSender.keyDown('A');");
+ }
+
return obj->pluginTest->NPP_SetWindow(window);
}
@@ -799,6 +810,12 @@ void NPP_URLNotify(NPP instance, const char *url, NPReason reason, void *notifyD
handleCallback(obj, url, reason, notifyData);
}
+void NPP_URLRedirectNotify(NPP instance, const char *url, int32_t status, void *notifyData)
+{
+ PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
+ obj->pluginTest->NPP_URLRedirectNotify(url, status, notifyData);
+}
+
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
#ifdef XP_UNIX