Bug 763171 - Open tabs for URIs received from Sync; r=rnewman

This commit is contained in:
Gregory Szorc 2012-06-22 22:28:23 -07:00
Родитель b71c8ae6be
Коммит 70e1e3d5c9
1 изменённых файлов: 21 добавлений и 1 удалений

Просмотреть файл

@ -15,7 +15,9 @@ let gSyncUI = {
"weave:ui:login:error",
"weave:ui:sync:error",
"weave:ui:sync:finish",
"weave:ui:clear-error"],
"weave:ui:clear-error",
"weave:engine:clients:display-uri",
],
_unloaded: false,
@ -395,6 +397,21 @@ let gSyncUI = {
this.updateUI();
},
/**
* Observer called when display URI command is received.
*/
onDisplayURI: function onDisplayURI(data) {
if (!gBrowser) {
return;
}
try {
gBrowser.addTab(data.wrappedJSObject.object.uri);
} catch (ex) {
Cu.reportError("Error displaying tab received by Sync: " + ex);
}
},
observe: function SUI_observe(subject, topic, data) {
if (this._unloaded) {
Cu.reportError("SyncUI observer called after unload: " + topic);
@ -444,6 +461,9 @@ let gSyncUI = {
case "weave:ui:clear-error":
this.clearError();
break;
case "weave:engine:clients:display-uri":
this.onDisplayURI(subject);
break;
}
},