Bug 1381375 - Show proper error message for 404 not found media source on video controls. r=jaws draft
authorRay Lin <ralin@mozilla.com>
Mon, 30 Oct 2017 13:55:08 +0800
changeset 689183 eba73c4bd1b8becdae76ee72b6955a67e4d95394
parent 689081 083a9c84fbd09a6ff9bfecabbf773650842fe1c0
child 738262 e10832ebfee4ac4e3e64d901ce881a97b48be93e
push id86959
push userbmo:ralin@mozilla.com
push dateTue, 31 Oct 2017 08:05:18 +0000
reviewersjaws
bugs1381375
milestone58.0a1
Bug 1381375 - Show proper error message for 404 not found media source on video controls. r=jaws MozReview-Commit-ID: JbMGBnlhH3w
toolkit/content/tests/widgets/test_videocontrols_error.html
toolkit/content/widgets/videocontrols.xml
--- a/toolkit/content/tests/widgets/test_videocontrols_error.html
+++ b/toolkit/content/tests/widgets/test_videocontrols_error.html
@@ -33,17 +33,17 @@
   }));
 
   testCases.push(() => new Promise(resolve => {
     video.src = "invalid-path.ogg";
     video.addEventListener("error", resolve);
   }));
 
   testCases.push(() => new Promise(resolve => {
-    const errorType = "errorSrcNotSupported";
+    const errorType = "errorNoSource";
 
     ok(!statusOverlay.hidden, `statusOverlay should show when ${errorType}`);
     is(statusOverlay.getAttribute("error"), errorType, `statusOverlay should have correct error state: ${errorType}`);
     is(statusIcon.getAttribute("type"), "error", `should show error icon when ${errorType}`);
 
     resolve();
   }));
 
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -761,17 +761,19 @@
               break;
             case v.error.MEDIA_ERR_NETWORK:
               error = "errorNetwork";
               break;
             case v.error.MEDIA_ERR_DECODE:
               error = "errorDecode";
               break;
             case v.error.MEDIA_ERR_SRC_NOT_SUPPORTED:
-              error = "errorSrcNotSupported";
+              error = v.networkState == v.NETWORK_NO_SOURCE ?
+                "errorNoSource" :
+                "errorSrcNotSupported";
               break;
             default:
               error = "errorGeneric";
               break;
           }
         } else if (v.networkState == v.NETWORK_NO_SOURCE) {
           error = "errorNoSource";
         } else {