diff --git a/dom/plugins/test/reftest/reftest.list b/dom/plugins/test/reftest/reftest.list index f82fe6894cac..e072ba56c47c 100644 --- a/dom/plugins/test/reftest/reftest.list +++ b/dom/plugins/test/reftest/reftest.list @@ -25,4 +25,5 @@ random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) = random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) == plugin-background-10-step.html plugin-background-ref.html random-if(!haveTestPlugin) == plugin-transform-1.html plugin-transform-1-ref.html fails-if(!haveTestPlugin) == plugin-transform-2.html plugin-transform-2-ref.html +skip-if(!haveTestPlugin) == shrink-1.html shrink-1-ref.html fails-if(!haveTestPlugin) == windowless-layers.html windowless-layers-ref.html diff --git a/dom/plugins/test/reftest/shrink-1-ref.html b/dom/plugins/test/reftest/shrink-1-ref.html new file mode 100644 index 000000000000..63ea4f46c808 --- /dev/null +++ b/dom/plugins/test/reftest/shrink-1-ref.html @@ -0,0 +1,10 @@ + + +
+ + + + + diff --git a/dom/plugins/test/reftest/shrink-1.html b/dom/plugins/test/reftest/shrink-1.html new file mode 100644 index 000000000000..3dc275990a62 --- /dev/null +++ b/dom/plugins/test/reftest/shrink-1.html @@ -0,0 +1,23 @@ + + + + + + + + + diff --git a/dom/plugins/test/testplugin/README b/dom/plugins/test/testplugin/README index 6774be396c64..8179613fb580 100644 --- a/dom/plugins/test/testplugin/README +++ b/dom/plugins/test/testplugin/README @@ -197,6 +197,9 @@ Returns the window width that was current when the plugin last painted. When value is true, every time the plugin paints, it will invalidate itself *during the paint* using NPN_Invalidate. +* setSlowPaint(value) +When value is true, the instance will sleep briefly during paint. + == Plugin geometry == The test plugin supports the following scriptable methods: diff --git a/dom/plugins/test/testplugin/nptest.cpp b/dom/plugins/test/testplugin/nptest.cpp index b9a5416a929d..60f1ca5e3b2b 100644 --- a/dom/plugins/test/testplugin/nptest.cpp +++ b/dom/plugins/test/testplugin/nptest.cpp @@ -125,6 +125,7 @@ static bool getLastMouseY(NPObject* npobj, const NPVariant* args, uint32_t argCo static bool getPaintCount(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result); static bool getWidthAtLastPaint(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result); static bool setInvalidateDuringPaint(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result); +static bool setSlowPaint(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result); static bool getError(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result); static bool doInternalConsistencyCheck(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result); static bool setColor(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result); @@ -186,6 +187,7 @@ static const NPUTF8* sPluginMethodIdentifierNames[] = { "getPaintCount", "getWidthAtLastPaint", "setInvalidateDuringPaint", + "setSlowPaint", "getError", "doInternalConsistencyCheck", "setColor", @@ -248,6 +250,7 @@ static const ScriptableFunction sPluginMethodFunctions[] = { getPaintCount, getWidthAtLastPaint, setInvalidateDuringPaint, + setSlowPaint, getError, doInternalConsistencyCheck, setColor, @@ -499,6 +502,15 @@ static void sendBufferToFrame(NPP instance) } } +static void XPSleep(unsigned int seconds) +{ +#ifdef XP_WIN + Sleep(1000 * seconds); +#else + sleep(seconds); +#endif +} + TestFunction getFuncFromString(const char* funcname) { @@ -765,6 +777,7 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* instanceData->hasWidget = false; instanceData->npnNewStream = false; instanceData->invalidateDuringPaint = false; + instanceData->slowPaint = false; instanceData->writeCount = 0; instanceData->writeReadyCount = 0; memset(&instanceData->window, 0, sizeof(instanceData->window)); @@ -2489,6 +2502,22 @@ setInvalidateDuringPaint(NPObject* npobj, const NPVariant* args, uint32_t argCou return true; } +static bool +setSlowPaint(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result) +{ + if (argCount != 1) + return false; + + if (!NPVARIANT_IS_BOOLEAN(args[0])) + return false; + bool slow = NPVARIANT_TO_BOOLEAN(args[0]); + + NPP npp = static_cast