Bug 834075 - Handle the error in case the sender is already unloaded. a=akeybl
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Wed, 06 Feb 2013 05:38:42 +0900
changeset 127420 c55dbea12268c556f5acc5837973679ae7db577b
parent 127419 3eeb9c28f829c824d30cb33173f5ed557606276a
child 127421 df5345414bb18ad5ad5d36e55cb7c861631f1c19
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersakeybl
bugs834075
milestone20.0a2
Bug 834075 - Handle the error in case the sender is already unloaded. a=akeybl
browser/extensions/pdfjs/components/PdfStreamConverter.js
--- a/browser/extensions/pdfjs/components/PdfStreamConverter.js
+++ b/browser/extensions/pdfjs/components/PdfStreamConverter.js
@@ -462,17 +462,23 @@ RequestListener.prototype.receive = func
     message.setUserData('response', response, null);
   } else {
     var response;
     if (!message.getUserData('callback')) {
       doc.documentElement.removeChild(message);
       response = null;
     } else {
       response = function sendResponse(response) {
-        message.setUserData('response', response, null);
+        try {
+          message.setUserData('response', response, null);
+        } catch (e) {
+          // message is no longer accessible because the sender is already
+          // gone. the unloaded sender cannot receive the response anyway.
+          return false;
+        }
 
         var listener = doc.createEvent('HTMLEvents');
         listener.initEvent('pdf.js.response', true, false);
         return message.dispatchEvent(listener);
       }
     }
     actions[action].call(this.actions, data, response);
   }