Bug 1352567 - Remove tests for plugin stream behavior except NP_NORMAL, r=jimm
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 02 Oct 2017 12:39:08 -0700
changeset 426608 989ab34fd26da1673f0c1c03e5f555ecfdba6976
parent 426607 6f575308a3818ded268d34403f1aa158502290e1
child 426609 0dfd227a6a20a7eec7c41b84381e63e8718fd861
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewersjimm
bugs1352567
milestone58.0a1
Bug 1352567 - Remove tests for plugin stream behavior except NP_NORMAL, r=jimm MozReview-Commit-ID: 8ne3cKV1bxc
dom/plugins/test/mochitest/mochitest.ini
dom/plugins/test/mochitest/test_pluginstream_asfile.html
dom/plugins/test/mochitest/test_pluginstream_asfileonly.html
dom/plugins/test/mochitest/test_twostreams.html
dom/plugins/test/testplugin/README
dom/plugins/test/testplugin/nptest.cpp
dom/plugins/test/testplugin/nptest.h
--- a/dom/plugins/test/mochitest/mochitest.ini
+++ b/dom/plugins/test/mochitest/mochitest.ini
@@ -106,18 +106,16 @@ skip-if = !crashreporter || e10s
 skip-if = toolkit == 'android' # needs plugin support
 [test_painting.html]
 skip-if = (toolkit == "cocoa" && e10s) # bug 1252230
 [test_plugin_scroll_invalidation.html]
 skip-if = toolkit != "gtk2"
 support-files = plugin_scroll_invalidation.html
 [test_plugin_scroll_painting.html]
 skip-if = true # Bug 596491
-[test_pluginstream_asfile.html]
-[test_pluginstream_asfileonly.html]
 [test_pluginstream_err.html]
 [test_pluginstream_geturl.html]
 skip-if = true # Bug 1267432
 [test_pluginstream_geturlnotify.html]
 skip-if = true # Bug 1267432
 [test_pluginstream_post.html]
 [test_pluginstream_poststream.html]
 [test_pluginstream_referer.html]
@@ -135,17 +133,16 @@ skip-if = (toolkit != "cocoa") || (os !=
 [test_redirect_handling.html]
 [test_refresh_navigator_plugins.html]
 skip-if = e10s # Bug 1090576
 [test_secondPlugin.html]
 [test_src_url_change.html]
 [test_streamatclose.html]
 [test_streamNotify.html]
 [test_stringHandling.html]
-[test_twostreams.html]
 [test_visibility.html]
 skip-if = toolkit == "cocoa"
 [test_windowed_invalidate.html]
 skip-if = os != "win"
 [test_windowless_flash.html]
 skip-if = !(os == "win" && processor == "x86_64")
 [test_windowless_ime.html]
 skip-if = os != "win"
deleted file mode 100644
--- a/dom/plugins/test/mochitest/test_pluginstream_asfile.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<html>
-<head>
-  <title>NPAPI NP_ASFILE NPStream Test</title>
-  <script type="text/javascript" 
-          src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" 
-          src="pluginstream.js"></script>
-  <script type="text/javascript" src="plugin-utils.js"></script>
-  <script type="text/javascript">
-    setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
-  </script>
-  <link rel="stylesheet" type="text/css" 
-        href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-  <p id="display"></p>
-
-  <iframe id="testframe" name="testframe" onload="frameLoaded()"></iframe>
-
-  <!--
-   - Similar to the above tests, but NPP_NewStream sets the stream mode
-   - to NP_ASFILE.  In this test, stream data is written in a series of
-   - NPP_Write calls, as per NP_NORMAL, and also written to a file whose
-   - path is passed to NPP_StreamAsFile.  The plugin compares the file
-   - and the stream to verify they're indentical, then passes the stream
-   - back to the browser via NPN_GetURL as above.
-   -->
-  <embed src="loremipsum_file.txt" streammode="asfile"
-         frame="testframe"
-         id="embedtest" style="width: 400px; height: 100px;"
-         type="application/x-test"></embed>
- </body>
- </html>
deleted file mode 100644
--- a/dom/plugins/test/mochitest/test_pluginstream_asfileonly.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<html>
-<head>
-  <title>NPAPI NP_ASFILEONLY NPStream Test</title>
-  <script type="text/javascript" 
-          src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" 
-          src="pluginstream.js"></script>
-  <script type="text/javascript" src="plugin-utils.js"></script>
-  <script type="text/javascript">
-    setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
-  </script>
-  <link rel="stylesheet" type="text/css" 
-        href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-  <p id="display"></p>
-
-  <iframe id="testframe" name="testframe" onload="frameLoaded()"></iframe>
-
-  <!--
-   - Similar to above, but NPP_NewStream sets to the stream mode
-   - to NP_ASFILEONLY, so the entire stream is written to a file
-   - and the file is read by the plugin when NPP_StreamAsFile is called.
-   -->
-  <embed src="loremipsum_file.txt" streammode="asfileonly"
-         frame="testframe"
-         id="embedtest" style="width: 400px; height: 100px;"
-         type="application/x-test"></embed>
- </body>
- </html>
deleted file mode 100644
--- a/dom/plugins/test/mochitest/test_twostreams.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<html>
-<head>
-  <title>Dual NPAPI NP_ASFILEONLY NPStream Test</title>
-  <script type="text/javascript" 
-          src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="plugin-utils.js"></script>
-  <link rel="stylesheet" type="text/css" 
-        href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-  <p id="display"></p>
-
-  <script type="text/javascript">
-  SimpleTest.expectAssertions(0, 2);
-
-  SimpleTest.waitForExplicitFinish();
-  setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
-
-  var framesToLoad = 2;
-  function frameLoaded(id) {
-    var frame = document.getElementById('testframe' + id);
-    // We have to use SpecialPowers because nptest.cpp prepends
-    // data: whichs makes the frame cross origin with the including page.
-    var wrappedDoc = SpecialPowers.wrap(frame).contentDocument;
-
-    if (!wrappedDoc.body.innerHTML.length)
-      return;
-
-    --framesToLoad;
-    if (0 == framesToLoad) {
-      var frame1 = document.getElementById('testframe1');
-      var frame2 = document.getElementById('testframe2');
-      var wrappedDocFrame1 = SpecialPowers.wrap(frame1).contentDocument;
-      var wrappedDocFrame2 = SpecialPowers.wrap(frame2).contentDocument;
-
-      is(wrappedDocFrame1.body.innerHTML, wrappedDocFrame2.body.innerHTML,
-         "Frame contents should match");
-      SimpleTest.finish();
-    }
-  }
-  </script>
-
-  <iframe id="testframe1" name="testframe1" onload="frameLoaded(1)"></iframe>
-  <iframe id="testframe2" name="testframe2" onload="frameLoaded(2)"></iframe>
-
-  <embed src="loremipsum_nocache.txt" streammode="asfileonly"
-         frame="testframe1"
-         id="embedtest" style="width: 400px; height: 100px;"
-         type="application/x-test"></embed>
-  <embed src="loremipsum_nocache.txt" streammode="asfileonly"
-	 frame="testframe2"
-	 id="embedtest2" style="width: 400px; height: 100px;"
-	 type="application/x-test"></embed>
-
--- a/dom/plugins/test/testplugin/README
+++ b/dom/plugins/test/testplugin/README
@@ -297,20 +297,16 @@ is specified) send the data from that st
 stream, whereupon it will be displayed in the specified frame.  If some
 error occurs during stream processing, an error message will appear in the
 frame instead of the stream data. If no "frame" attribute is present, a 
 stream can still be received by the plugin, but the plugin will do nothing
 with it.
 
 The attributes which control stream tests are:
 
-"streammode": one of "normal", "asfile", "asfileonly", "seek". Sets the
-  stream mode to the specified mode in any call to NPP_NewStream.
-  Defaults to "asfileonly".
-
 "streamchunksize": the number of bytes the plugin reports it can accept
   in calls to NPP_WriteReady.  Defaults to 1,024.
 
 "src": a url.  If specified, the browser will call NPP_NewStream for
   this url as soon as the plugin is initialized.
 
 "geturl": a url.  If specified, the plugin will request this url
   from the browser when the plugin is initialized, via a call to
@@ -328,25 +324,16 @@ The attributes which control stream test
   element which instantiated the plugin. For any of the preceding three
   attributes, a stream is received by the plugin via calls to NPP_NewStream,
   NPP_WriteReady, NPP_Write, and NPP_DestroyStream.  When NPP_DestroyStream
   is called (or NPP_UrlNotify, in the case of "geturlnotify"), and a 
   "frame" attribute is present, the data from the stream is converted into a
   data: url, and sent back to the browser in another stream via a call to
   NPN_GetURL, whereupon it should be displayed in the specified frame.
 
-"range": one or more byte ranges, in the format "offset,length;offset,length".
-  Only valid when "streammode" = "seek".  When "range" is present, the plugin
-  will request the specified byte ranges from the stream via a call to
-  NPN_RequestRead, which it makes after the browser makes its final call to
-  NPP_Write.  The plugin verifies that the browser makes additional calls
-  to NPP_Write according to the requested byte ranges, and that the data
-  received is correct.  Any errors will appear in the test "frame", if
-  specified.
-
 "posturl": a url.  After the plugin receives a stream, and NPP_DestroyStream
   is called, if "posturl" is specified, the plugin will post the contents
   of the stream to the specified url via NPN_PostURL.  See "postmode" for
   additional details.
 
 "postmode": either "frame" or "stream".  If "frame", and a "frame" attribute
   is present, the plugin will pass the frame name to calls to NPN_PostURL,
   so that the HTTP response from that operation will be displayed in the
@@ -363,20 +350,16 @@ The attributes which control stream test
 "functiontofail": one of "npp_newstream", "npp_write", "npp_destroystream".
   When specified, the given function will return an error code (-1 for
   NPP_Write, or else the value of the "failurecode" attribute) the first time
   it is called by the browser.
 
 "failurecode": one of the NPError constants.  Used to specify the error
   that will be returned by the "functiontofail".
 
-If the plugin is instantiated as a full-page plugin, the following defaults
-are used:
-  streammode="seek" frame="testframe" range="100,100"
-
 * streamTest(url, doPost, postData, writeCallback, notifyCallback, redirectCallback, allowRedirects, postFile = false)
 This will test how NPN_GetURLNotify and NPN_PostURLNotify behave when they are
 called with arbitrary (malformed) URLs. The function will return `true` if
 NPN_[Get/Post]URLNotify succeeds, and `false` if it fails.
 @url url to request
 @param doPost whether to call NPN_PostURLNotify
 @param postData null, or a string to send a postdata
 @writeCallback will be called when data is received for the stream
--- a/dom/plugins/test/testplugin/nptest.cpp
+++ b/dom/plugins/test/testplugin/nptest.cpp
@@ -421,49 +421,23 @@ static void clearIdentifiers()
   memset(sPluginMethodIdentifiers, 0,
       MOZ_ARRAY_LENGTH(sPluginMethodIdentifiers) * sizeof(NPIdentifier));
   memset(sPluginPropertyIdentifiers, 0,
       MOZ_ARRAY_LENGTH(sPluginPropertyIdentifiers) * sizeof(NPIdentifier));
 
   sIdentifiersInitialized = false;
 }
 
-static void addRange(InstanceData* instanceData, const char* range)
-{
-  /*
-  increased rangestr size from 16 to 17, the 17byte is only for
-  null terminated value, maybe for actual capacity it needs 16 bytes
-  */
-  char rangestr[17];
-  memset(rangestr, 0, sizeof(rangestr));
-  strncpy(rangestr, range, sizeof(rangestr) - sizeof(char));
-  const char* str1 = strtok(rangestr, ",");
-  const char* str2 = str1 ? strtok(nullptr, ",") : nullptr;
-  if (str1 && str2) {
-    TestRange* byterange = new TestRange;
-    byterange->offset = atoi(str1);
-    byterange->length = atoi(str2);
-    byterange->waiting = true;
-    byterange->next = instanceData->testrange;
-    instanceData->testrange = byterange;
-  }
-}
-
 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 ||
-      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");
@@ -667,17 +641,16 @@ static bool fillPluginFunctionTable(NPPl
   if (pFuncs->size < (offsetof(NPPluginFuncs, getsiteswithdata) + sizeof(void*)))
     return false;
 
   pFuncs->newp = NPP_New;
   pFuncs->destroy = NPP_Destroy;
   pFuncs->setwindow = NPP_SetWindow;
   pFuncs->newstream = NPP_NewStream;
   pFuncs->destroystream = NPP_DestroyStream;
-  pFuncs->asfile = NPP_StreamAsFile;
   pFuncs->writeready = NPP_WriteReady;
   pFuncs->write = NPP_Write;
   pFuncs->print = NPP_Print;
   pFuncs->event = NPP_HandleEvent;
   pFuncs->urlnotify = NPP_URLNotify;
   pFuncs->getvalue = NPP_GetValue;
   pFuncs->setvalue = NPP_SetValue;
   pFuncs->urlredirectnotify = NPP_URLRedirectNotify;
@@ -773,30 +746,26 @@ NPP_New(NPMIMEType pluginType, NPP insta
   if (!browserSupportsWindowless && !pluginSupportsWindowMode()) {
     printf("Windowless mode not supported by the browser, windowed mode not supported by the plugin!\n");
     return NPERR_GENERIC_ERROR;
   }
 
   // set up our our instance data
   InstanceData* instanceData = new InstanceData;
   instanceData->npp = instance;
-  instanceData->streamMode = NP_ASFILEONLY;
   instanceData->testFunction = FUNCTION_NONE;
   instanceData->functionToFail = FUNCTION_NONE;
   instanceData->failureCode = 0;
   instanceData->callOnDestroy = nullptr;
   instanceData->streamChunkSize = 1024;
   instanceData->streamBuf = nullptr;
   instanceData->streamBufSize = 0;
-  instanceData->fileBuf = nullptr;
-  instanceData->fileBufSize = 0;
   instanceData->throwOnNextInvoke = false;
   instanceData->runScriptOnPaint = false;
   instanceData->dontTouchElement = false;
-  instanceData->testrange = nullptr;
   instanceData->hasWidget = false;
   instanceData->npnNewStream = false;
   instanceData->invalidateDuringPaint = false;
   instanceData->slowPaint = false;
   instanceData->playingAudio = false;
   instanceData->audioMuted = false;
   instanceData->writeCount = 0;
   instanceData->writeReadyCount = 0;
@@ -851,31 +820,16 @@ NPP_New(NPMIMEType pluginType, NPP insta
     }
     else if (strcmp(argn[i], "asyncmodel") == 0) {
       if (strcmp(argv[i], "bitmap") == 0) {
         requestAsyncDrawing = AD_BITMAP;
       } else if (strcmp(argv[i], "dxgi") == 0) {
         requestAsyncDrawing = AD_DXGI;
       }
     }
-    if (strcmp(argn[i], "streammode") == 0) {
-      if (strcmp(argv[i], "normal") == 0) {
-        instanceData->streamMode = NP_NORMAL;
-      }
-      else if ((strcmp(argv[i], "asfile") == 0) &&
-                strlen(argv[i]) == strlen("asfile")) {
-        instanceData->streamMode = NP_ASFILE;
-      }
-      else if (strcmp(argv[i], "asfileonly") == 0) {
-        instanceData->streamMode = NP_ASFILEONLY;
-      }
-      else if (strcmp(argv[i], "seek") == 0) {
-        instanceData->streamMode = NP_SEEK;
-      }
-    }
     if (strcmp(argn[i], "streamchunksize") == 0) {
       instanceData->streamChunkSize = atoi(argv[i]);
     }
     if (strcmp(argn[i], "failurecode") == 0) {
       instanceData->failureCode = atoi(argv[i]);
     }
     if (strcmp(argn[i], "functiontofail") == 0) {
       instanceData->functionToFail = getFuncFromString(argv[i]);
@@ -898,30 +852,16 @@ NPP_New(NPMIMEType pluginType, NPP insta
       }
       else if (strcmp(argv[i], "stream") == 0) {
         instanceData->postMode = POSTMODE_STREAM;
       }
     }
     if (strcmp(argn[i], "frame") == 0) {
       instanceData->frame = argv[i];
     }
-    if (strcmp(argn[i], "range") == 0) {
-      string range = argv[i];
-      size_t semicolon = range.find(';');
-      while (semicolon != string::npos) {
-        addRange(instanceData, range.substr(0, semicolon).c_str());
-        if (semicolon == range.length()) {
-          range = "";
-          break;
-        }
-        range = range.substr(semicolon + 1);
-        semicolon = range.find(';');
-      }
-      if (range.length()) addRange(instanceData, range.c_str());
-    }
     if (strcmp(argn[i], "newstream") == 0 &&
         strcmp(argv[i], "true") == 0) {
       instanceData->npnNewStream = true;
     }
     if (strcmp(argn[i], "newcrash") == 0) {
       IntentionalCrash();
     }
     if (strcmp(argn[i], "paintscript") == 0) {
@@ -956,25 +896,16 @@ NPP_New(NPMIMEType pluginType, NPP insta
       if (alreadyHasSalign) {
         // If salign came before this parameter, error out now.
         return NPERR_GENERIC_ERROR;
       }
     }
     if (strcmp(argn[i], "salign") == 0) {
       alreadyHasSalign = true;
     }
-
-    // We don't support NP_FULL any more, but name="plugin" is an indication
-    // that we're a full-page plugin. We use default seek parameters for
-    // test_fullpage.html
-    if (strcmp(argn[i], "name") == 0 && strcmp(argv[i], "plugin") == 0) {
-      instanceData->streamMode = NP_SEEK;
-      instanceData->frame = "testframe";
-      addRange(instanceData, "100,100");
-    }
   }
 
   if (!browserSupportsWindowless || !pluginSupportsWindowlessMode()) {
     requestWindow = true;
   } else if (!pluginSupportsWindowMode()) {
     requestWindow = false;
   }
   if (requestWindow) {
@@ -1091,27 +1022,16 @@ NPP_Destroy(NPP instance, NPSavedData** 
     NPN_InvokeDefault(instance, instanceData->callOnDestroy, nullptr, 0, &result);
     NPN_ReleaseVariantValue(&result);
     NPN_ReleaseObject(instanceData->callOnDestroy);
   }
 
   if (instanceData->streamBuf) {
     free(instanceData->streamBuf);
   }
-  if (instanceData->fileBuf) {
-    free(instanceData->fileBuf);
-  }
-
-  TestRange* currentrange = instanceData->testrange;
-  TestRange* nextrange;
-  while (currentrange != nullptr) {
-    nextrange = reinterpret_cast<TestRange*>(currentrange->next);
-    delete currentrange;
-    currentrange = nextrange;
-  }
 
   if (instanceData->frontBuffer) {
     NPN_SetCurrentAsyncSurface(instance, nullptr, nullptr);
     NPN_FinalizeAsyncSurface(instance, instanceData->frontBuffer);
     NPN_MemFree(instanceData->frontBuffer);
   }
   if (instanceData->backBuffer) {
     NPN_FinalizeAsyncSurface(instance, instanceData->backBuffer);
@@ -1216,17 +1136,17 @@ NPP_NewStream(NPP instance, NPMIMEType t
   }
 
   if (stream->notifyData &&
       static_cast<URLNotifyData*>(stream->notifyData) != &kNotifyData) {
     // stream from streamTest
     *stype = NP_NORMAL;
   }
   else {
-    *stype = instanceData->streamMode;
+    *stype = NP_NORMAL;
 
     if (instanceData->streamBufSize) {
       free(instanceData->streamBuf);
       instanceData->streamBufSize = 0;
       if (instanceData->testFunction == FUNCTION_NPP_POSTURL &&
           instanceData->postMode == POSTMODE_STREAM) {
         instanceData->testFunction = FUNCTION_NPP_GETURL;
       }
@@ -1264,36 +1184,16 @@ NPP_DestroyStream(NPP instance, NPStream
     return instanceData->failureCode;
   }
 
   URLNotifyData* nd = static_cast<URLNotifyData*>(stream->notifyData);
   if (nd && nd != &kNotifyData) {
     return NPERR_NO_ERROR;
   }
 
-  if (instanceData->streamMode == NP_ASFILE &&
-      instanceData->functionToFail == FUNCTION_NONE) {
-    if (!instanceData->streamBuf) {
-      instanceData->err <<
-        "Error: no data written with NPP_Write";
-      return NPERR_GENERIC_ERROR;
-    }
-
-    if (!instanceData->fileBuf) {
-      instanceData->err <<
-        "Error: no data written with NPP_StreamAsFile";
-      return NPERR_GENERIC_ERROR;
-    }
-
-    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 &&
       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,
@@ -1365,50 +1265,26 @@ NPP_Write(NPP instance, NPStream* stream
 
   if (nd && nd != &kNotifyData) {
     uint32_t newsize = nd->size + len;
     nd->data = (char*) realloc(nd->data, newsize);
     memcpy(nd->data + nd->size, buffer, len);
     nd->size = newsize;
     return len;
   }
-  if (instanceData->streamMode == NP_SEEK &&
-      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);
-      if (err != NPERR_NO_ERROR) {
-        instanceData->err << "NPN_RequestRead returned error %d" << err;
-      }
-      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 <<
-          "Error: data written from NPN_RequestRead doesn't match";
+          "Error: data written doesn't match";
     }
     else {
       printf("data matches!\n");
     }
-    TestRange* range = instanceData->testrange;
-    while(range != nullptr) {
-      if (offset == range->offset &&
-        (uint32_t)len == range->length) {
-        range->waiting = false;
-      }
-      range = reinterpret_cast<TestRange*>(range->next);
-    }
   }
   else {
     if (instanceData->streamBufSize == 0) {
       instanceData->streamBuf = malloc(len + 1);
       streamBuf = reinterpret_cast<char *>(instanceData->streamBuf);
     }
     else {
       instanceData->streamBuf =
@@ -1419,53 +1295,16 @@ NPP_Write(NPP instance, NPStream* stream
     memcpy(streamBuf + instanceData->streamBufSize, buffer, len);
     instanceData->streamBufSize = instanceData->streamBufSize + len;
     streamBuf[instanceData->streamBufSize] = '\0';
   }
   return len;
 }
 
 void
-NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
-{
-  size_t size;
-
-  InstanceData* instanceData = (InstanceData*)(instance->pdata);
-
-  if (instanceData->functionToFail == FUNCTION_NPP_NEWSTREAM ||
-      instanceData->functionToFail == FUNCTION_NPP_WRITE) {
-    instanceData->err << "NPP_StreamAsFile called";
-  }
-
-  if (!fname)
-    return;
-
-  FILE *file = fopen(fname, "rb");
-  if (file) {
-    fseek(file, 0, SEEK_END);
-    size = ftell(file);
-    instanceData->fileBuf = malloc((int32_t)size + 1);
-    char* buf = reinterpret_cast<char *>(instanceData->fileBuf);
-    fseek(file, 0, SEEK_SET);
-    size_t sizeRead = fread(instanceData->fileBuf, 1, size, file);
-    if (sizeRead != size) {
-      printf("Unable to read data from file\n");
-      instanceData->err << "Unable to read data from file " << fname;
-    }
-    fclose(file);
-    buf[size] = '\0';
-    instanceData->fileBufSize = (int32_t)size;
-  }
-  else {
-    printf("Unable to open file\n");
-    instanceData->err << "Unable to open file " << fname;
-  }
-}
-
-void
 NPP_Print(NPP instance, NPPrint* platformPrint)
 {
 }
 
 int16_t
 NPP_HandleEvent(NPP instance, void* event)
 {
   InstanceData* instanceData = (InstanceData*)(instance->pdata);
@@ -1819,22 +1658,16 @@ NPN_GetURLNotify(NPP instance, const cha
 
 NPError
 NPN_GetURL(NPP instance, const char* url, const char* target)
 {
   return sBrowserFuncs->geturl(instance, url, target);
 }
 
 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,
                   const char* buf, NPBool file, void* notifyData)
 {
   return sBrowserFuncs->posturlnotify(instance, url, target, len, buf, file, notifyData);
 }
 
 NPError
--- a/dom/plugins/test/testplugin/nptest.h
+++ b/dom/plugins/test/testplugin/nptest.h
@@ -86,20 +86,16 @@ typedef enum {
 typedef struct TestNPObject : NPObject {
   NPP npp;
   DrawMode drawMode;
   uint32_t drawColor; // 0xAARRGGBB
 } TestNPObject;
 
 typedef struct _PlatformData PlatformData;
 
-typedef struct TestRange : NPByteRange {
-  bool waiting;
-} TestRange;
-
 typedef struct InstanceData {
   NPP npp;
   NPWindow window;
   TestNPObject* scriptableObject;
   PlatformData* platformData;
   int32_t instanceCountWatchGeneration;
   bool lastReportedPrivateModeState;
   bool hasWidget;
@@ -125,23 +121,19 @@ typedef struct InstanceData {
   TestFunction functionToFail;
   NPError failureCode;
   NPObject* callOnDestroy;
   PostMode postMode;
   std::string testUrl;
   std::string frame;
   std::string timerTestScriptCallback;
   std::ostringstream err;
-  uint16_t streamMode;
   int32_t streamChunkSize;
   int32_t streamBufSize;
-  int32_t fileBufSize;
-  TestRange* testrange;
   void* streamBuf;
-  void* fileBuf;
   bool crashOnDestroy;
   bool cleanupWidget;
   ActivationState topLevelWindowActivationState;
   int32_t topLevelWindowActivationEventCount;
   ActivationState focusState;
   int32_t focusEventCount;
   int32_t eventModel;
   bool closeStream;