From cf8848100d7a6f6131b627737649e7c6700ecb53 Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Fri, 11 Apr 2014 17:46:59 -0400 Subject: [PATCH] Bug 993633 - Add better failure handling in CastingApps.openExternal r=wesj --- mobile/android/chrome/content/CastingApps.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mobile/android/chrome/content/CastingApps.js b/mobile/android/chrome/content/CastingApps.js index dd0c3c676107..e53aac2cd0c3 100644 --- a/mobile/android/chrome/content/CastingApps.js +++ b/mobile/android/chrome/content/CastingApps.js @@ -124,7 +124,7 @@ var CastingApps = { // Use the file extension to guess the mime type let sourceURI = this.makeURI(sourceURL, null, this.makeURI(aElement.baseURI)); if (allowableExtension(sourceURI)) { - return { video: aElement, source: sourceURI.spec, poster: posterURL }; + return { element: aElement, source: sourceURI.spec, poster: posterURL }; } } @@ -137,7 +137,7 @@ var CastingApps = { // Using the type attribute is our ideal way to guess the mime type. Otherwise, // fallback to using the file extension to guess the mime type if (sourceNode.type == "video/mp4" || allowableExtension(sourceURI)) { - return { video: aElement, source: sourceURI.spec, poster: posterURL }; + return { element: aElement, source: sourceURI.spec, poster: posterURL }; } } @@ -201,8 +201,18 @@ var CastingApps = { } app.stop(function() { - app.start(function() { + app.start(function(aStarted) { + if (!aStarted) { + dump("CastingApps: Unable to start app"); + return; + } + app.remoteMedia(function(aRemoteMedia) { + if (!aRemoteMedia) { + dump("CastingApps: Failed to create remotemedia"); + return; + } + this.session = { service: aService, app: app,