Security/Reviews/Gaia/SystemMessageHandler: Difference between revisions

Jump to navigation Jump to search
Line 25: Line 25:
     boolean mozHasPendingMessage(in DOMString type);  
     boolean mozHasPendingMessage(in DOMString type);  
  };
  };
The top level api, mozSetMessageHandler, is used by all system components and applications that need to receive messages.
The most common use case is that applications (certified, privileged) use this API to listen to `activity` messages, which are received when another app initiated a MozActivity. For example, in the Camera:
apps/camera/js/camera.js
309    navigator.mozSetMessageHandler('activity', function(activity) {
310      var name = activity.source.name;
311      if (name === 'pick') {
312        Camera.initPick(activity);
313      }
It is also used by system components to listen to more low level components that are not available to just any application. For example:
apps/settings/js/bluetooth.js
320:      navigator.mozSetMessageHandler('bluetooth-requestconfirmation',
326:      navigator.mozSetMessageHandler('bluetooth-requestpincode',
332:      navigator.mozSetMessageHandler('bluetooth-requestpasskey',
338:      navigator.mozSetMessageHandler('bluetooth-cancel',
344:      navigator.mozSetMessageHandler('bluetooth-pairedstatuschanged',
350:      navigator.mozSetMessageHandler('bluetooth-hfp-status-changed',


==== Relevant Documentation ====
==== Relevant Documentation ====
Confirmed users
971

edits

Navigation menu