Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #21140 from vingtetun/bug1030675.followup
Browse files Browse the repository at this point in the history
Bug 1030675 - Handle search app crashes. Followup. r=kgrandon
  • Loading branch information
vingtetun authored and rvandermeulen committed Jun 30, 2014
1 parent 4b77c51 commit f5f7943
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion apps/system/js/rocketbar.js
Expand Up @@ -837,7 +837,7 @@
* @memberof Rocketbar.prototype
*/
handleSearchCrashed: function(e) {
if (!this._searchWindow) {
if (!this.searchWindow) {
return;
}

Expand Down Expand Up @@ -868,6 +868,10 @@
this._port = 'pending';
navigator.mozApps.getSelf().onsuccess = function() {
var app = this.result;
if (!app) {
return;
}

app.connect('search').then(
function onConnectionAccepted(ports) {
ports.forEach(function(port) {
Expand Down
9 changes: 8 additions & 1 deletion apps/system/test/unit/rocketbar_test.js
@@ -1,6 +1,6 @@
'use strict';
/* global Rocketbar, MocksHelper, MockAppWindow, MockAppWindowManager,
MockIACPort */
MockIACPort, MockSearchWindow */

requireApp('system/test/unit/mock_app_window.js');
requireApp('system/test/unit/mock_app_window_manager.js');
Expand Down Expand Up @@ -843,8 +843,15 @@ suite('system/Rocketbar', function() {

// Dispatch a crash event.
window.dispatchEvent(new CustomEvent('searchcrashed'));

assert.equal(subject.searchWindow, null);
assert.equal(subject._port, null);

subject.loadSearchApp();
assert.ok(spy.calledWithNew);

assert.ok(subject.searchWindow instanceof MockSearchWindow);
assert.equal(subject._port, 'pending');
});

test('setVisible', function() {
Expand Down

0 comments on commit f5f7943

Please sign in to comment.