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 #27811 from dwi2/bug1127746
Browse files Browse the repository at this point in the history
Bug 1127746 - [Stingray] Use navigator.mozPresentation instead of navigator.presentation, r=rexboy
  • Loading branch information
dwi2 committed Jan 31, 2015
2 parents 5ce984f + 354373d commit ab69ae0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
16 changes: 8 additions & 8 deletions tv_apps/notification-receiver/_test/unit/receiver_test.js
Expand Up @@ -14,15 +14,15 @@ suite('notification-receiver/Receiver', function() {
var realNotification;

suiteSetup(function() {
realPresentation = window.navigator.presentation;
window.navigator.presentation = MockPresentation;
realPresentation = navigator.mozPresentation;
navigator.mozPresentation = MockPresentation;

realNotification = window.Notification;
window.Notification = MockNotification;
});

suiteTeardown(function() {
window.navigator.presentation = realPresentation;
navigator.mozPresentation = realPresentation;
window.Notification = realNotification;
});

Expand All @@ -34,7 +34,7 @@ suite('notification-receiver/Receiver', function() {

teardown(function() {
MockPresentationSession.addEventListener.restore();
navigator.presentation._mReset();
navigator.mozPresentation._mReset();
receiver.uninit();
});

Expand All @@ -44,7 +44,7 @@ suite('notification-receiver/Receiver', function() {

assert.isFalse(receiver._handleSessionReady.called);
receiver.init();
navigator.presentation._mInjectSession(
navigator.mozPresentation._mInjectSession(
MockPresentationSession._mCreateSession());
assert.isTrue(receiver._handleSessionReady.calledOnce);
assert.isTrue(
Expand All @@ -55,7 +55,7 @@ suite('notification-receiver/Receiver', function() {

test('> _handleSessionReady should called once ' +
'when session object is ready', function() {
navigator.presentation._mInjectSession(
navigator.mozPresentation._mInjectSession(
MockPresentationSession._mCreateSession());
this.sinon.spy(receiver, '_handleSessionReady');

Expand All @@ -73,13 +73,13 @@ suite('notification-receiver/Receiver', function() {
setup(function() {
receiver = new Receiver();
this.sinon.spy(receiver, '_handleMessage');
navigator.presentation._mInjectSession(
navigator.mozPresentation._mInjectSession(
MockPresentationSession._mCreateSession());
receiver.init();
});

teardown(function() {
navigator.presentation._mReset();
navigator.mozPresentation._mReset();
receiver.uninit();
});

Expand Down
14 changes: 7 additions & 7 deletions tv_apps/notification-receiver/js/receiver.js
Expand Up @@ -35,22 +35,22 @@
this._onMessage = this._handleMessage.bind(this);
this._onStateChange = this._handleStateChange.bind(this);

if (navigator.presentation) {
if (navigator.presentation.session) {
if (navigator.mozPresentation) {
if (navigator.mozPresentation.session) {
this._onSessionReady();
} else {
navigator.presentation.addEventListener('sessionready',
navigator.mozPresentation.addEventListener('sessionready',
this._onSessionReady);
}
}
},

uninit: function r_uninit() {
if (navigator.presentation) {
navigator.presentation.removeEventListener('sessionready',
if (navigator.mozPresentation) {
navigator.mozPresentation.removeEventListener('sessionready',
this._onSessionReady);

var session = navigator.presentation.session;
var session = navigator.mozPresentation.session;
if (session) {
session.removeEventListener('message', this._onMessage);
session.removeEventListener('statechange', this._onStateChange);
Expand All @@ -59,7 +59,7 @@
},

_handleSessionReady: function r_handleSessionReady() {
var session = navigator.presentation.session;
var session = navigator.mozPresentation.session;
session.addEventListener('message', this._onMessage);
session.addEventListener('statechange', this._onStateChange);
},
Expand Down
Expand Up @@ -27,13 +27,13 @@ suite('NotificationSender >', function() {

setup(function() {
subject = new NotificationSender();
realPresentation = navigator.presentation;
navigator.presentation = MockPresentation;
realPresentation = navigator.mozPresentation;
navigator.mozPresentation = MockPresentation;

});

teardown(function() {
navigator.presentation = realPresentation;
navigator.mozPresentation = realPresentation;
MockPresentation._mReset();
MockPresentationSession._mReset();
});
Expand Down
4 changes: 2 additions & 2 deletions tv_apps/notification-sender/js/notification_sender.js
Expand Up @@ -54,11 +54,11 @@
},

connect: function ns_connect() {
if(!navigator.presentation) {
if(!navigator.mozPresentation) {
return null;
}

return navigator.presentation.startSession(this.urlInput.value).then(
return navigator.mozPresentation.startSession(this.urlInput.value).then(

function onFullfilled(session) {
this.session = session;
Expand Down

0 comments on commit ab69ae0

Please sign in to comment.