sbMediacoreErrorHandler.js
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2009 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
25 const Cc = Components.classes;
26 const Ci = Components.interfaces;
27 const Cu = Components.utils;
28 
29 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
30 
32 
33 // Array to put errors into while the dialog is being opened
35 
36 /******************************************************************************
37  * http://bugzilla.songbirdnest.com/show_bug.cgi?id=17812
38  * Responsible for passing mediacore errors to the error dialog and making sure
39  * only one instance of the dialog is open at any time.
40  *****************************************************************************/
41 function ErrorHandler() {
42 }
43 
44 ErrorHandler.prototype = {
45  classDescription: "Songbird Mediacore error handler",
46  classID: Components.ID("{8bb6de60-a11b-11de-8a39-0800200c9a66}"),
47  contractID: "@songbirdnest.com/Songbird/MediacoreErrorHandler;1",
48  QueryInterface: XPCOMUtils.generateQI([Ci.sbIMediacoreErrorHandler]),
49 
55  processError: function ErrorHandler_processError(aError) {
56  var Application = Cc["@mozilla.org/fuel/application;1"]
57  .getService(Ci.fuelIApplication);
58  if (Application.prefs.getValue("songbird.mediacore.error.dontshowme",
59  false)) {
60  return;
61  }
62 
63  if (errorDialog && !errorDialog.closed) {
64  if (errorQueue)
65  errorQueue.push(aError);
66  else
67  errorDialog.addError(aError);
68  }
69  else {
70  var windowWatcher = Cc["@mozilla.org/embedcomp/window-watcher;1"]
71  .getService(Ci.nsIWindowWatcher);
72  errorDialog = windowWatcher.openWindow(windowWatcher.activeWindow,
73  "chrome://songbird/content/xul/mediacore/mediacoreErrorDialog.xul",
74  null,
75  "centerscreen,chrome,resizable,titlebar",
76  aError);
77 
78  // Queue up further errors until the dialog finishes loading
79  errorQueue = [];
80  errorDialog.addEventListener("load", function() {
81  for each (let error in errorQueue)
82  errorDialog.addError(error);
83  errorQueue = null;
84  }, false);
85  }
86  }
87 }
88 
89 function NSGetModule(compMgr, fileSpec) {
90  return XPCOMUtils.generateModule([ErrorHandler]);
91 }
function ErrorHandler()
var Application
Definition: sbAboutDRM.js:37
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbOSDControlService prototype QueryInterface
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
return null
Definition: FeedWriter.js:1143
var errorDialog
sbDeviceFirmwareAutoCheckForUpdate prototype classID
var errorQueue