Bug 980625 - Strip trailing whitespace plague from nptest.cpp. r=josh
authorJohn Schoenick <jschoenick@mozilla.com>
Tue, 11 Mar 2014 11:56:58 -0700
changeset 191426 763eb7c3207568fc73a171dfca18831c9d08355b
parent 191425 505119ed119ec39c9e9fc09cf17c868946401f90
child 191427 56ff5e931815c6fd9206f9f998d735fa49b2e4dd
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjosh
bugs980625
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 980625 - Strip trailing whitespace plague from nptest.cpp. r=josh
dom/plugins/test/testplugin/nptest.cpp
--- a/dom/plugins/test/testplugin/nptest.cpp
+++ b/dom/plugins/test/testplugin/nptest.cpp
@@ -1,40 +1,40 @@
 /* ***** BEGIN LICENSE BLOCK *****
- * 
+ *
  * Copyright (c) 2008, Mozilla Corporation
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright notice, this
  *   list of conditions and the following disclaimer.
  * * Redistributions in binary form must reproduce the above copyright notice,
  *   this list of conditions and the following disclaimer in the documentation
  *   and/or other materials provided with the distribution.
  * * Neither the name of the Mozilla Corporation nor the names of its
  *   contributors may be used to endorse or promote products derived from this
  *   software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
+ *
  * Contributor(s):
  *   Dave Townsend <dtownsend@oxymoronical.com>
  *   Josh Aas <josh@mozilla.com>
- * 
+ *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nptest.h"
 #include "nptest_utils.h"
 #include "nptest_platform.h"
 
 #include "mozilla/IntentionalCrash.h"
 
@@ -384,17 +384,17 @@ static bool sClearByAgeSupported;
 static void initializeIdentifiers()
 {
   if (!sIdentifiersInitialized) {
     NPN_GetStringIdentifiers(sPluginMethodIdentifierNames,
         ARRAY_LENGTH(sPluginMethodIdentifierNames), sPluginMethodIdentifiers);
     NPN_GetStringIdentifiers(sPluginPropertyIdentifierNames,
         ARRAY_LENGTH(sPluginPropertyIdentifierNames), sPluginPropertyIdentifiers);
 
-    sIdentifiersInitialized = true;    
+    sIdentifiersInitialized = true;
 
     // Check whether nullptr is handled in NPN_GetStringIdentifiers
     NPIdentifier IDList[2];
     static char const *const kIDNames[2] = { nullptr, "setCookie" };
     NPN_GetStringIdentifiers(const_cast<const NPUTF8**>(kIDNames), 2, IDList);
   }
 }
 
@@ -426,48 +426,48 @@ static void addRange(InstanceData* insta
 
 static void sendBufferToFrame(NPP instance)
 {
   InstanceData* instanceData = (InstanceData*)(instance->pdata);
   string outbuf;
   if (!instanceData->npnNewStream) outbuf = "data:text/html,";
   const char* buf = reinterpret_cast<char *>(instanceData->streamBuf);
   int32_t bufsize = instanceData->streamBufSize;
-  if (instanceData->streamMode == NP_ASFILE || 
+  if (instanceData->streamMode == NP_ASFILE ||
       instanceData->streamMode == NP_ASFILEONLY) {
     buf = reinterpret_cast<char *>(instanceData->fileBuf);
     bufsize = instanceData->fileBufSize;
   }
   if (instanceData->err.str().length() > 0) {
     outbuf.append(instanceData->err.str());
   }
   else if (bufsize > 0) {
     outbuf.append(buf);
   }
   else {
     outbuf.append("Error: no data in buffer");
   }
-  
+
   if (instanceData->npnNewStream &&
       instanceData->err.str().length() == 0) {
     char typeHTML[] = "text/html";
     NPStream* stream;
     printf("calling NPN_NewStream...");
-    NPError err = NPN_NewStream(instance, typeHTML, 
+    NPError err = NPN_NewStream(instance, typeHTML,
         instanceData->frame.c_str(), &stream);
     printf("return value %d\n", err);
     if (err != NPERR_NO_ERROR) {
       instanceData->err << "NPN_NewStream returned " << err;
       return;
     }
-    
+
     int32_t bytesToWrite = outbuf.length();
     int32_t bytesWritten = 0;
     while ((bytesToWrite - bytesWritten) > 0) {
-      int32_t numBytes = (bytesToWrite - bytesWritten) < 
+      int32_t numBytes = (bytesToWrite - bytesWritten) <
           instanceData->streamChunkSize ?
           bytesToWrite - bytesWritten : instanceData->streamChunkSize;
       int32_t written = NPN_Write(instance, stream,
           numBytes, (void*)(outbuf.c_str() + bytesWritten));
       if (written <= 0) {
         instanceData->err << "NPN_Write returned " << written;
         break;
       }
@@ -498,17 +498,17 @@ static void sendBufferToFrame(NPP instan
           char hex[8];
           sprintf(hex, "%%%x", ascii);
           outbuf.replace(i, 1, hex);
           i += 2;
         }
       }
     }
 
-    NPError err = NPN_GetURL(instance, outbuf.c_str(), 
+    NPError err = NPN_GetURL(instance, outbuf.c_str(),
                              instanceData->frame.c_str());
     if (err != NPERR_NO_ERROR) {
       instanceData->err << "NPN_GetURL returned " << err;
     }
   }
 }
 
 static void XPSleep(unsigned int seconds)
@@ -518,17 +518,17 @@ static void XPSleep(unsigned int seconds
 #else
   sleep(seconds);
 #endif
 }
 
 TestFunction
 getFuncFromString(const char* funcname)
 {
-  FunctionTable funcTable[] = 
+  FunctionTable funcTable[] =
     {
       { FUNCTION_NPP_NEWSTREAM, "npp_newstream" },
       { FUNCTION_NPP_WRITEREADY, "npp_writeready" },
       { FUNCTION_NPP_WRITE, "npp_write" },
       { FUNCTION_NPP_DESTROYSTREAM, "npp_destroystream" },
       { FUNCTION_NPP_WRITE_RPC, "npp_write_rpc" },
       { FUNCTION_NONE, nullptr }
     };
@@ -851,17 +851,17 @@ NPP_New(NPMIMEType pluginType, NPP insta
     addRange(instanceData, "100,100");
   }
 
   bool requestWindow = false;
   // handle extra params
   for (int i = 0; i < argc; i++) {
     if (strcmp(argn[i], "drawmode") == 0) {
       if (strcmp(argv[i], "solid") == 0)
-        scriptableObject->drawMode = DM_SOLID_COLOR;    
+        scriptableObject->drawMode = DM_SOLID_COLOR;
     }
     else if (strcmp(argn[i], "color") == 0) {
       scriptableObject->drawColor = parseHexColor(argv[i], strlen(argv[i]));
     }
     else if (strcmp(argn[i], "wmode") == 0) {
       if (strcmp(argv[i], "window") == 0) {
         requestWindow = true;
       }
@@ -1029,17 +1029,17 @@ NPP_New(NPMIMEType pluginType, NPP insta
   NPObject* o = nullptr;
   err = NPN_GetValue(instance, NPNVPluginElementNPObject, &o);
   if (err == NPERR_NO_ERROR) {
     NPN_SetProperty(instance, o,
                     NPN_GetStringIdentifier("pluginFoundElement"), &variantTrue);
     NPN_ReleaseObject(o);
     o = nullptr;
   }
-  
+
   // Set a property on NPNVWindowNPObject
   err = NPN_GetValue(instance, NPNVWindowNPObject, &o);
   if (err == NPERR_NO_ERROR) {
     NPN_SetProperty(instance, o,
                     NPN_GetStringIdentifier("pluginFoundWindow"), &variantTrue);
     NPN_ReleaseObject(o);
     o = nullptr;
   }
@@ -1048,17 +1048,17 @@ NPP_New(NPMIMEType pluginType, NPP insta
 
   if (instanceData->testFunction == FUNCTION_NPP_GETURL) {
     NPError err = NPN_GetURL(instance, instanceData->testUrl.c_str(), nullptr);
     if (err != NPERR_NO_ERROR) {
       instanceData->err << "NPN_GetURL returned " << err;
     }
   }
   else if (instanceData->testFunction == FUNCTION_NPP_GETURLNOTIFY) {
-    NPError err = NPN_GetURLNotify(instance, instanceData->testUrl.c_str(), 
+    NPError err = NPN_GetURLNotify(instance, instanceData->testUrl.c_str(),
                                    nullptr, static_cast<void*>(&kNotifyData));
     if (err != NPERR_NO_ERROR) {
       instanceData->err << "NPN_GetURLNotify returned " << err;
     }
   }
 
   if ((instanceData->bugMode == 813906) && instanceData->frame.length()) {
     bug813906(instance, "f", "browser.xul", instanceData->frame.c_str());
@@ -1173,17 +1173,17 @@ NPP_SetWindow(NPP instance, NPWindow* wi
   return NPERR_NO_ERROR;
 }
 
 NPError
 NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype)
 {
   printf("NPP_NewStream\n");
   InstanceData* instanceData = (InstanceData*)(instance->pdata);
-  
+
   if (instanceData->functionToFail == FUNCTION_NPP_NEWSTREAM &&
       instanceData->failureCode) {
     instanceData->err << SUCCESS_STRING;
     if (instanceData->frame.length() > 0) {
       sendBufferToFrame(instance);
     }
     return instanceData->failureCode;
   }
@@ -1252,30 +1252,30 @@ NPP_DestroyStream(NPP instance, NPStream
     }
 
     if (!instanceData->fileBuf) {
       instanceData->err <<
         "Error: no data written with NPP_StreamAsFile";
       return NPERR_GENERIC_ERROR;
     }
 
-    if (strcmp(reinterpret_cast<char *>(instanceData->fileBuf), 
+    if (strcmp(reinterpret_cast<char *>(instanceData->fileBuf),
                reinterpret_cast<char *>(instanceData->streamBuf))) {
       instanceData->err <<
         "Error: data passed to NPP_Write and NPP_StreamAsFile differed";
     }
   }
-  if (instanceData->frame.length() > 0 && 
+  if (instanceData->frame.length() > 0 &&
       instanceData->testFunction != FUNCTION_NPP_GETURLNOTIFY &&
       instanceData->testFunction != FUNCTION_NPP_POSTURL) {
     sendBufferToFrame(instance);
   }
   if (instanceData->testFunction == FUNCTION_NPP_POSTURL) {
-    NPError err = NPN_PostURL(instance, instanceData->testUrl.c_str(), 
-      instanceData->postMode == POSTMODE_FRAME ? instanceData->frame.c_str() : nullptr, 
+    NPError err = NPN_PostURL(instance, instanceData->testUrl.c_str(),
+      instanceData->postMode == POSTMODE_FRAME ? instanceData->frame.c_str() : nullptr,
       instanceData->streamBufSize,
       reinterpret_cast<char *>(instanceData->streamBuf), false);
     if (err != NPERR_NO_ERROR)
       instanceData->err << "Error: NPN_PostURL returned error value " << err;
   }
   return NPERR_NO_ERROR;
 }
 
@@ -1283,17 +1283,17 @@ int32_t
 NPP_WriteReady(NPP instance, NPStream* stream)
 {
   printf("NPP_WriteReady\n");
   InstanceData* instanceData = (InstanceData*)(instance->pdata);
   instanceData->writeReadyCount++;
   if (instanceData->functionToFail == FUNCTION_NPP_NEWSTREAM) {
     instanceData->err << "NPP_WriteReady called";
   }
-  
+
   // temporarily disabled per bug 519870
   //if (instanceData->writeReadyCount == 1) {
   //  return 0;
   //}
 
   return instanceData->streamChunkSize;
 }
 
@@ -1313,17 +1313,17 @@ NPP_Write(NPP instance, NPStream* stream
     // Make an RPC call and pretend to consume the data
     NPObject* windowObject = nullptr;
     NPN_GetValue(instance, NPNVWindowNPObject, &windowObject);
     if (windowObject)
       NPN_ReleaseObject(windowObject);
 
     return len;
   }
-  
+
   if (instanceData->functionToFail == FUNCTION_NPP_NEWSTREAM) {
     instanceData->err << "NPP_Write called";
   }
 
   if (instanceData->functionToFail == FUNCTION_NPP_WRITE) {
     return -1;
   }
 
@@ -1349,17 +1349,17 @@ NPP_Write(NPP instance, NPStream* stream
   if (instanceData->closeStream) {
     instanceData->closeStream = false;
     if (instanceData->testrange != nullptr) {
       NPN_RequestRead(stream, instanceData->testrange);
     }
     NPN_DestroyStream(instance, stream, NPRES_USER_BREAK);
   }
   else if (instanceData->streamMode == NP_SEEK &&
-      stream->end != 0 && 
+      stream->end != 0 &&
       stream->end == ((uint32_t)instanceData->streamBufSize + len)) {
     // If the complete stream has been written, and we're doing a seek test,
     // then call NPN_RequestRead.
     // prevent recursion
     instanceData->streamMode = NP_NORMAL;
 
     if (instanceData->testrange != nullptr) {
       NPError err = NPN_RequestRead(stream, instanceData->testrange);
@@ -1368,17 +1368,17 @@ NPP_Write(NPP instance, NPStream* stream
       }
       printf("called NPN_RequestRead, return %d\n", err);
     }
   }
 
   char* streamBuf = reinterpret_cast<char *>(instanceData->streamBuf);
   if (offset + len <= instanceData->streamBufSize) {
     if (memcmp(buffer, streamBuf + offset, len)) {
-      instanceData->err << 
+      instanceData->err <<
           "Error: data written from NPN_RequestRead doesn't match";
     }
     else {
       printf("data matches!\n");
     }
     TestRange* range = instanceData->testrange;
     bool stillwaiting = false;
     while(range != nullptr) {
@@ -1397,18 +1397,18 @@ NPP_Write(NPP instance, NPStream* stream
     }
   }
   else {
     if (instanceData->streamBufSize == 0) {
       instanceData->streamBuf = malloc(len + 1);
       streamBuf = reinterpret_cast<char *>(instanceData->streamBuf);
     }
     else {
-      instanceData->streamBuf = 
-        realloc(reinterpret_cast<char *>(instanceData->streamBuf), 
+      instanceData->streamBuf =
+        realloc(reinterpret_cast<char *>(instanceData->streamBuf),
         instanceData->streamBufSize + len + 1);
       streamBuf = reinterpret_cast<char *>(instanceData->streamBuf);
     }
     memcpy(streamBuf + instanceData->streamBufSize, buffer, len);
     instanceData->streamBufSize = instanceData->streamBufSize + len;
     streamBuf[instanceData->streamBufSize] = '\0';
   }
   return len;
@@ -1808,40 +1808,40 @@ NPN_GetURL(NPP instance, const char* url
 
 NPError
 NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
 {
   return sBrowserFuncs->requestread(stream, rangeList);
 }
 
 NPError
-NPN_PostURLNotify(NPP instance, const char* url, 
-                  const char* target, uint32_t len, 
+NPN_PostURLNotify(NPP instance, const char* url,
+                  const char* target, uint32_t len,
                   const char* buf, NPBool file, void* notifyData)
 {
   return sBrowserFuncs->posturlnotify(instance, url, target, len, buf, file, notifyData);
 }
 
-NPError 
+NPError
 NPN_PostURL(NPP instance, const char *url,
                     const char *target, uint32_t len,
                     const char *buf, NPBool file)
 {
   return sBrowserFuncs->posturl(instance, url, target, len, buf, file);
 }
 
 NPError
 NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
 {
   return sBrowserFuncs->destroystream(instance, stream, reason);
 }
 
 NPError
-NPN_NewStream(NPP instance, 
-              NPMIMEType  type, 
+NPN_NewStream(NPP instance,
+              NPMIMEType  type,
               const char* target,
               NPStream**  stream)
 {
   return sBrowserFuncs->newstream(instance, type, target, stream);
 }
 
 int32_t
 NPN_Write(NPP instance,
@@ -1853,17 +1853,17 @@ NPN_Write(NPP instance,
 }
 
 bool
 NPN_Enumerate(NPP instance,
               NPObject *npobj,
               NPIdentifier **identifiers,
               uint32_t *identifierCount)
 {
-  return sBrowserFuncs->enumerate(instance, npobj, identifiers, 
+  return sBrowserFuncs->enumerate(instance, npobj, identifiers,
       identifierCount);
 }
 
 bool
 NPN_GetProperty(NPP instance,
                 NPObject *npobj,
                 NPIdentifier propertyName,
                 NPVariant *result)
@@ -1994,17 +1994,17 @@ scriptableInvoke(NPObject* npobj, NPIden
     else {
       for (uint32_t i = 0; i < argCount; i++) {
         const NPString* argstr = &NPVARIANT_TO_STRING(args[i]);
         NPN_SetException(npobj, argstr->UTF8Characters);
       }
     }
     return false;
   }
-  
+
   for (int i = 0; i < int(ARRAY_LENGTH(sPluginMethodIdentifiers)); i++) {
     if (name == sPluginMethodIdentifiers[i])
       return sPluginMethodFunctions[i](npobj, args, argCount, result);
   }
   return false;
 }
 
 bool
@@ -2136,17 +2136,17 @@ compareVariants(NPP instance, const NPVa
 {
   bool success = true;
   InstanceData* id = static_cast<InstanceData*>(instance->pdata);
   if (var1->type != var2->type) {
     id->err << "Variant types don't match; got " << var1->type <<
         " expected " << var2->type;
     return false;
   }
-  
+
   switch (var1->type) {
     case NPVariantType_Int32: {
         int32_t result = NPVARIANT_TO_INT32(*var1);
         int32_t expected = NPVARIANT_TO_INT32(*var2);
         if (result != expected) {
           id->err << "Variant values don't match; got " << result <<
               " expected " << expected;
           success = false;
@@ -2179,18 +2179,18 @@ compareVariants(NPP instance, const NPVa
         }
         break;
       }
     case NPVariantType_String: {
         const NPString* result = &NPVARIANT_TO_STRING(*var1);
         const NPString* expected = &NPVARIANT_TO_STRING(*var2);
         if (strcmp(result->UTF8Characters, expected->UTF8Characters) ||
             strlen(result->UTF8Characters) != strlen(expected->UTF8Characters)) {
-          id->err << "Variant values don't match; got " << 
-              result->UTF8Characters << " expected " << 
+          id->err << "Variant values don't match; got " <<
+              result->UTF8Characters << " expected " <<
               expected->UTF8Characters;
           success = false;
         }
         break;
       }
     case NPVariantType_Object: {
         uint32_t i, identifierCount = 0;
         NPIdentifier* identifiers;
@@ -2216,67 +2216,67 @@ compareVariants(NPP instance, const NPVa
             }
             else {
               if (!NPN_GetProperty(instance, result, identifiers[i],
               &resultVariant)) {
                 id->err << "NPN_GetProperty 2 returned false";
                 success = false;
               }
               else {
-                success = compareVariants(instance, &resultVariant, 
+                success = compareVariants(instance, &resultVariant,
                     &expectedVariant);
                 NPN_ReleaseVariantValue(&expectedVariant);
               }
             }
             NPN_ReleaseVariantValue(&resultVariant);
           }
         }
         break;
       }
     default:
       id->err << "Unknown variant type";
       success = false;
   }
-  
+
   return success;
 }
 
 static bool
 throwExceptionNextInvoke(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
   NPP npp = static_cast<TestNPObject*>(npobj)->npp;
   InstanceData* id = static_cast<InstanceData*>(npp->pdata);
   id->throwOnNextInvoke = true;
   BOOLEAN_TO_NPVARIANT(true, *result);
-  return true;  
+  return true;
 }
 
 static bool
 npnInvokeDefaultTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
   bool success = false;
   NPP npp = static_cast<TestNPObject*>(npobj)->npp;
- 
+
   NPObject* windowObject;
   NPN_GetValue(npp, NPNVWindowNPObject, &windowObject);
   if (!windowObject)
     return false;
 
   NPIdentifier objectIdentifier = variantToIdentifier(args[0]);
   if (!objectIdentifier)
     return false;
 
   NPVariant objectVariant;
   if (NPN_GetProperty(npp, windowObject, objectIdentifier,
       &objectVariant)) {
     if (NPVARIANT_IS_OBJECT(objectVariant)) {
       NPObject* selfObject = NPVARIANT_TO_OBJECT(objectVariant);
       if (selfObject != nullptr) {
         NPVariant resultVariant;
-        if (NPN_InvokeDefault(npp, selfObject, argCount > 1 ? &args[1] : nullptr, 
+        if (NPN_InvokeDefault(npp, selfObject, argCount > 1 ? &args[1] : nullptr,
             argCount - 1, &resultVariant)) {
           *result = resultVariant;
           success = true;
         }
       }
     }
     NPN_ReleaseVariantValue(&objectVariant);
   }
@@ -2292,53 +2292,53 @@ npnInvokeTest(NPObject* npobj, const NPV
   InstanceData* id = static_cast<InstanceData*>(npp->pdata);
   id->err.str("");
   if (argCount < 2)
     return false;
 
   NPIdentifier function = variantToIdentifier(args[0]);
   if (!function)
     return false;
-  
+
   NPObject* windowObject;
   NPN_GetValue(npp, NPNVWindowNPObject, &windowObject);
   if (!windowObject)
     return false;
-  
+
   NPVariant invokeResult;
   bool invokeReturn = NPN_Invoke(npp, windowObject, function,
       argCount > 2 ? &args[2] : nullptr, argCount - 2, &invokeResult);
-      
+
   bool compareResult = compareVariants(npp, &invokeResult, &args[1]);
-      
+
   NPN_ReleaseObject(windowObject);
   NPN_ReleaseVariantValue(&invokeResult);
   BOOLEAN_TO_NPVARIANT(invokeReturn && compareResult, *result);
   return true;
 }
 
 static bool
 npnEvaluateTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
   bool success = false;
   NPP npp = static_cast<TestNPObject*>(npobj)->npp;
-  
+
   if (argCount != 1)
     return false;
-  
+
   if (!NPVARIANT_IS_STRING(args[0]))
     return false;
 
   NPObject* windowObject;
   NPN_GetValue(npp, NPNVWindowNPObject, &windowObject);
   if (!windowObject)
     return false;
-  
+
   success = NPN_Evaluate(npp, windowObject, (NPString*)&NPVARIANT_TO_STRING(args[0]), result);
-  
+
   NPN_ReleaseObject(windowObject);
   return success;
 }
 
 static bool
 setUndefinedValueTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
   NPP npp = static_cast<TestNPObject*>(npobj)->npp;
@@ -2658,17 +2658,17 @@ convertPointY(NPObject* npobj, const NPV
   double sourceY = static_cast<double>(NPVARIANT_TO_INT32(args[2]));
 
   if (!NPVARIANT_IS_INT32(args[3]))
     return false;
   int32_t destSpace = NPVARIANT_TO_INT32(args[3]);
 
   double resultX, resultY;
   NPN_ConvertPoint(npp, sourceX, sourceY, (NPCoordinateSpace)sourceSpace, &resultX, &resultY, (NPCoordinateSpace)destSpace);
-  
+
   DOUBLE_TO_NPVARIANT(resultY, *result);
   return true;
 }
 
 static bool
 streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
   // .streamTest(url, doPost, doNull, writeCallback, notifyCallback, redirectCallback, allowRedirects)
@@ -2949,22 +2949,22 @@ static bool enableFPExceptions(NPObject*
 #else
   return false;
 #endif
 }
 
 // caller is responsible for freeing return buffer
 static char* URLForInstanceWindow(NPP instance) {
   char *outString = nullptr;
-  
+
   NPObject* windowObject = nullptr;
   NPError err = NPN_GetValue(instance, NPNVWindowNPObject, &windowObject);
   if (err != NPERR_NO_ERROR || !windowObject)
     return nullptr;
-  
+
   NPIdentifier locationIdentifier = NPN_GetStringIdentifier("location");
   NPVariant locationVariant;
   if (NPN_GetProperty(instance, windowObject, locationIdentifier, &locationVariant)) {
     NPObject *locationObject = locationVariant.value.objectValue;
     if (locationObject) {
       NPIdentifier hrefIdentifier = NPN_GetStringIdentifier("href");
       NPVariant hrefVariant;
       if (NPN_GetProperty(instance, locationObject, hrefIdentifier, &hrefVariant)) {
@@ -2972,64 +2972,64 @@ static char* URLForInstanceWindow(NPP in
         if (hrefString) {
           outString = (char *)malloc(hrefString->UTF8Length + 1);
           if (outString) {
             strcpy(outString, hrefString->UTF8Characters);
             outString[hrefString->UTF8Length] = '\0';
           }
         }
         NPN_ReleaseVariantValue(&hrefVariant);
-      }      
+      }
     }
     NPN_ReleaseVariantValue(&locationVariant);
   }
-  
+
   NPN_ReleaseObject(windowObject);
-  
+
   return outString;
 }
 
 static bool
 setCookie(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
   if (argCount != 1)
     return false;
   if (!NPVARIANT_IS_STRING(args[0]))
     return false;
   const NPString* cookie = &NPVARIANT_TO_STRING(args[0]);
-  
+
   NPP npp = static_cast<TestNPObject*>(npobj)->npp;
-  
+
   char* url = URLForInstanceWindow(npp);
   if (!url)
     return false;
   NPError err = NPN_SetValueForURL(npp, NPNURLVCookie, url, cookie->UTF8Characters, cookie->UTF8Length);
   free(url);
-  
+
   return (err == NPERR_NO_ERROR);
 }
 
 static bool
 getCookie(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
   if (argCount != 0)
     return false;
-  
+
   NPP npp = static_cast<TestNPObject*>(npobj)->npp;
-  
+
   char* url = URLForInstanceWindow(npp);
   if (!url)
     return false;
   char* cookie = nullptr;
   unsigned int length = 0;
   NPError err = NPN_GetValueForURL(npp, NPNURLVCookie, url, &cookie, &length);
   free(url);
   if (err != NPERR_NO_ERROR || !cookie)
     return false;
-  
+
   STRINGZ_TO_NPVARIANT(cookie, *result);
   return true;
 }
 
 static bool
 getAuthInfo(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
   if (argCount != 5)
@@ -3046,43 +3046,43 @@ getAuthInfo(NPObject* npobj, const NPVar
   const NPString* host = &NPVARIANT_TO_STRING(args[1]);
   uint32_t port = NPVARIANT_TO_INT32(args[2]);
   const NPString* scheme = &NPVARIANT_TO_STRING(args[3]);
   const NPString* realm = &NPVARIANT_TO_STRING(args[4]);
 
   char* username = nullptr;
   char* password = nullptr;
   uint32_t ulen = 0, plen = 0;
-  
-  NPError err = NPN_GetAuthenticationInfo(npp, 
-      protocol->UTF8Characters, 
-      host->UTF8Characters, 
-      port, 
-      scheme->UTF8Characters, 
+
+  NPError err = NPN_GetAuthenticationInfo(npp,
+      protocol->UTF8Characters,
+      host->UTF8Characters,
+      port,
+      scheme->UTF8Characters,
       realm->UTF8Characters,
-      &username, 
-      &ulen, 
-      &password, 
+      &username,
+      &ulen,
+      &password,
       &plen);
-  
+
   if (err != NPERR_NO_ERROR) {
     return false;
   }
 
   char* outstring = (char*)NPN_MemAlloc(ulen + plen + 2);
   memset(outstring, 0, ulen + plen + 2);
   strncpy(outstring, username, ulen);
   strcat(outstring, "|");
   strncat(outstring, password, plen);
 
   STRINGZ_TO_NPVARIANT(outstring, *result);
 
   NPN_MemFree(username);
   NPN_MemFree(password);
-  
+
   return true;
 }
 
 static void timerCallback(NPP npp, uint32_t timerID)
 {
   InstanceData* id = static_cast<InstanceData*>(npp->pdata);
   currentTimerEventCount++;
   timerEvent event = timerEvents[currentTimerEventCount];
@@ -3100,17 +3100,17 @@ static void timerCallback(NPP npp, uint3
   if (currentTimerEventCount == totalTimerEvents - 1) {
     NPVariant arg;
     BOOLEAN_TO_NPVARIANT(id->timerTestResult, arg);
     NPN_Invoke(npp, windowObject, NPN_GetStringIdentifier(id->timerTestScriptCallback.c_str()), &arg, 1, &rval);
     NPN_ReleaseVariantValue(&arg);
   }
 
   NPN_ReleaseObject(windowObject);
-  
+
   if (event.timerIdSchedule > -1) {
     id->timerID[event.timerIdSchedule] = NPN_ScheduleTimer(npp, event.timerInterval, event.timerRepeat, timerCallback);
   }
   if (event.timerIdUnschedule > -1) {
     NPN_UnscheduleTimer(npp, id->timerID[event.timerIdUnschedule]);
   }
 }
 
@@ -3123,19 +3123,19 @@ timerTest(NPObject* npobj, const NPVaria
 
   if (argCount < 1 || !NPVARIANT_IS_STRING(args[0]))
     return false;
   const NPString* argstr = &NPVARIANT_TO_STRING(args[0]);
   id->timerTestScriptCallback = argstr->UTF8Characters;
 
   id->timerTestResult = true;
   timerEvent event = timerEvents[currentTimerEventCount];
-    
+
   id->timerID[event.timerIdSchedule] = NPN_ScheduleTimer(npp, event.timerInterval, event.timerRepeat, timerCallback);
-  
+
   return id->timerID[event.timerIdSchedule] != 0;
 }
 
 #ifdef XP_WIN
 void
 ThreadProc(void* cookie)
 #else
 void*
@@ -3166,17 +3166,17 @@ asyncCallback(void* cookie)
       if (_beginthread(ThreadProc, 0, (void*)npobj) == -1)
         id->asyncCallbackResult = false;
 #else
       pthread_t tid;
       if (pthread_create(&tid, 0, ThreadProc, (void*)npobj))
         id->asyncCallbackResult = false;
 #endif
       break;
-    
+
     // async callback triggered from different thread
     default:
       NPObject* windowObject;
       NPN_GetValue(npp, NPNVWindowNPObject, &windowObject);
       if (!windowObject)
         return;
       NPVariant arg, rval;
       BOOLEAN_TO_NPVARIANT(id->asyncCallbackResult, arg);
@@ -3192,21 +3192,21 @@ asyncCallbackTest(NPObject* npobj, const
 {
   NPP npp = static_cast<TestNPObject*>(npobj)->npp;
   InstanceData* id = static_cast<InstanceData*>(npp->pdata);
 
   if (argCount < 1 || !NPVARIANT_IS_STRING(args[0]))
     return false;
   const NPString* argstr = &NPVARIANT_TO_STRING(args[0]);
   id->asyncTestScriptCallback = argstr->UTF8Characters;
-  
+
   id->asyncTestPhase = 0;
   id->asyncCallbackResult = true;
   NPN_PluginThreadAsyncCall(npp, asyncCallback, (void*)npobj);
-  
+
   return true;
 }
 
 static bool
 GCRaceInvoke(NPObject*, NPIdentifier, const NPVariant*, uint32_t, NPVariant*)
 {
   return false;
 }
@@ -3282,17 +3282,17 @@ FinishGCRace(void* closure)
 bool
 checkGCRace(NPObject* npobj, const NPVariant* args, uint32_t argCount,
 	    NPVariant* result)
 {
   if (1 != argCount || !NPVARIANT_IS_OBJECT(args[0]))
     return false;
 
   NPP npp = static_cast<TestNPObject*>(npobj)->npp;
-  
+
   NPObject* localFunc =
     NPN_CreateObject(npp, const_cast<NPClass*>(&kGCRaceClass));
 
   GCRaceData* rd =
     new GCRaceData(npp, NPVARIANT_TO_OBJECT(args[0]), localFunc);
   NPN_PluginThreadAsyncCall(npp, FinishGCRace, rd);
 
   OBJECT_TO_NPVARIANT(localFunc, *result);
@@ -3305,17 +3305,17 @@ hangPlugin(NPObject* npobj, const NPVari
 {
   mozilla::NoteIntentionalCrash("plugin");
 
   bool busyHang = false;
   if ((argCount == 1) && NPVARIANT_IS_BOOLEAN(args[0])) {
     busyHang = NPVARIANT_TO_BOOLEAN(args[0]);
   }
 
-  if (busyHang) {    
+  if (busyHang) {
     const time_t start = std::time(nullptr);
     while ((std::time(nullptr) - start) < 100000) {
       volatile int dummy = 0;
       for (int i=0; i<1000; ++i) {
         dummy++;
       }
     }
   } else {
@@ -3655,17 +3655,17 @@ bool getWindowPosition(NPObject* npobj, 
 }
 
 bool constructObject(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
   if (argCount == 0 || !NPVARIANT_IS_OBJECT(args[0]))
     return false;
 
   NPObject* ctor = NPVARIANT_TO_OBJECT(args[0]);
-  
+
   NPP npp = static_cast<TestNPObject*>(npobj)->npp;
 
   return NPN_Construct(npp, ctor, args + 1, argCount - 1, result);
 }
 
 bool setSitesWithData(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
   if (argCount != 1 || !NPVARIANT_IS_STRING(args[0]))
@@ -3688,22 +3688,22 @@ bool setSitesWithData(NPObject* npobj, c
       next = end;
 
     // Parse out the three tokens into a siteData struct.
     const char* siteEnd = strchr(iterator, ':');
     *((char*) siteEnd) = '\0';
     const char* flagsEnd = strchr(siteEnd + 1, ':');
     *((char*) flagsEnd) = '\0';
     *((char*) next) = '\0';
-    
+
     siteData data;
     data.site = string(iterator);
     data.flags = atoi(siteEnd + 1);
     data.age = atoi(flagsEnd + 1);
-    
+
     sSitesWithData->push_back(data);
 
     if (next == end)
       break;
 
     iterator = next + 1;
   }
 
@@ -3751,17 +3751,17 @@ bool getNPNVdocumentOrigin(NPObject* npo
   return true;
 }
 
 bool getMouseUpEventCount(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {
   if (argCount != 0) {
     return false;
   }
-  
+
   NPP npp = static_cast<TestNPObject*>(npobj)->npp;
   InstanceData* id = static_cast<InstanceData*>(npp->pdata);
   INT32_TO_NPVARIANT(id->mouseUpEventCount, *result);
   return true;
 }
 
 bool queryContentsScaleFactor(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
 {