Comparing version 9.2.0 to 10.0.0
{ | ||
"name": "tal", | ||
"version": "9.2.0", | ||
"version": "10.0.0", | ||
"homepage": "http://fmtvp.github.io/tal/index.html", | ||
@@ -5,0 +5,0 @@ "description": "TAL was developed internally within the BBC as a way of vastly simplifying TV application development whilst increasing the reach of BBC TV applications such as iPlayer. Today all of the BBC’s HTML-based TV applications are built using TAL.", |
{ | ||
"name": "tal", | ||
"license": "Apache-2.0", | ||
"version": "9.2.0", | ||
"version": "10.0.0", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -89,3 +89,4 @@ /** | ||
return { | ||
href: 'http://www.test.com/#&*history=broadcast' | ||
href: 'http://www.test.com/?broadcast=true', | ||
search: '?broadcast=true' | ||
}; | ||
@@ -115,3 +116,4 @@ }); | ||
return { | ||
href: 'http://www.test.com/#&*history=broadcast' | ||
href: 'http://www.test.com/?broadcast=true', | ||
search: '?broadcast=true' | ||
}; | ||
@@ -195,2 +197,44 @@ }); | ||
}; | ||
this.ApplicationExitTest.prototype.testHasBroadcastOriginWithNoBroadcastUrlParameterReturnsFalse = function(queue) { | ||
queuedApplicationInit( | ||
queue, | ||
'lib/mockapplication', | ||
[ | ||
'antie/devices/browserdevice' | ||
], | ||
function(application, BrowserDevice) { | ||
// Configure BrowserDevice.getWindowLocation() to return canned data | ||
this.sandbox.stub(BrowserDevice.prototype, 'getWindowLocation', function() { | ||
return { | ||
href: 'http://www.test.com/', | ||
search: '?' | ||
}; | ||
}); | ||
assertFalse(application.hasBroadcastOrigin()); | ||
} | ||
); | ||
}; | ||
this.ApplicationExitTest.prototype.testHasBroadcastOriginWithBroadcastUrlParameterReturnsTrue = function(queue) { | ||
queuedApplicationInit( | ||
queue, | ||
'lib/mockapplication', | ||
[ | ||
'antie/devices/browserdevice' | ||
], | ||
function(application, BrowserDevice) { | ||
// Configure BrowserDevice.getWindowLocation() to return canned data | ||
this.sandbox.stub(BrowserDevice.prototype, 'getWindowLocation', function() { | ||
return { | ||
href: 'http://www.test.com/?broadcast=true', | ||
search: '?broadcast=true' | ||
}; | ||
}); | ||
assert(application.hasBroadcastOrigin()); | ||
} | ||
); | ||
}; | ||
}()); |
@@ -312,3 +312,3 @@ /** | ||
this.hbbtvSource.prototype.testIsBroadcastSourceSupportedWhenHistorianDoesNotHaveBroadcastOriginReturnsFalse = function(queue) { | ||
this.hbbtvSource.prototype.testIsBroadcastSourceSupportedWhenUrlDoesNotHaveBroadcastParameterReturnsFalse = function(queue) { | ||
expectAsserts(1); | ||
@@ -318,7 +318,7 @@ | ||
var self = this; | ||
queuedApplicationInit(queue, 'lib/mockapplication', ['antie/historian'], function(application, Historian) { | ||
queuedApplicationInit(queue, 'lib/mockapplication', [], function(application) { | ||
var device = application.getDevice(); | ||
self.sandbox.stub(Historian.prototype, 'hasBroadcastOrigin', function() { | ||
return false; | ||
self.sandbox.stub(application, 'getCurrentAppURLParameters', function() { | ||
return {}; | ||
}); | ||
@@ -330,3 +330,3 @@ | ||
this.hbbtvSource.prototype.testIsBroadcastSourceSupportedWhenHistorianHasBroadcastOriginReturnsTrue = function(queue) { | ||
this.hbbtvSource.prototype.testIsBroadcastSourceSupportedWhenUrlHasBroadcastParameterReturnsTrue = function(queue) { | ||
expectAsserts(1); | ||
@@ -336,7 +336,9 @@ | ||
var config = getGenericHBBTVConfig(); | ||
queuedApplicationInit(queue, 'lib/mockapplication', ['antie/historian'], function(application, Historian) { | ||
queuedApplicationInit(queue, 'lib/mockapplication', [], function(application) { | ||
var device = application.getDevice(); | ||
self.sandbox.stub(Historian.prototype, 'hasBroadcastOrigin', function() { | ||
return true; | ||
self.sandbox.stub(application, 'getCurrentAppURLParameters', function() { | ||
return { | ||
broadcast: 'true' | ||
}; | ||
}); | ||
@@ -343,0 +345,0 @@ |
@@ -242,67 +242,2 @@ /** | ||
}; | ||
this.HistorianTest.prototype.testHasHistoryReturnsFalseWithOnlyBroadcastHistory = function(queue) { | ||
queuedRequire( | ||
queue, | ||
[ | ||
'antie/historian' | ||
], | ||
function(Historian) { | ||
var historian = new Historian('http://www.test.com/test/#&*history=broadcast'); | ||
assertFalse('hasHistory()', historian.hasHistory()); | ||
} | ||
); | ||
}; | ||
this.HistorianTest.prototype.testHasHistoryReturnsTrueWithRealHistoryPlusBroadcastHistory = function(queue) { | ||
queuedRequire( | ||
queue, | ||
[ | ||
'antie/historian' | ||
], | ||
function(Historian) { | ||
var historian = new Historian('http://www.test.com/test/#&*history=http://www.test2.com&*history=broadcast'); | ||
assert('hasHistory()', historian.hasHistory()); | ||
} | ||
); | ||
}; | ||
this.HistorianTest.prototype.testBroadcastOriginSetTrueWithUrlAndBroadcast = function(queue) { | ||
queuedRequire( | ||
queue, | ||
[ | ||
'antie/historian' | ||
], | ||
function(Historian) { | ||
var historian = new Historian('http://www.test.com/test/#&*history=http://www.test2.com&*history=broadcast'); | ||
assert('hasBroadcastOrigin()', historian.hasBroadcastOrigin()); | ||
} | ||
); | ||
}; | ||
this.HistorianTest.prototype.testBroadcastOriginSetTrueWithJustBroadcast = function(queue) { | ||
queuedRequire( | ||
queue, | ||
[ | ||
'antie/historian' | ||
], | ||
function(Historian) { | ||
var historian = new Historian('http://www.test.com/test#&*history=broadcast'); | ||
assert('hasBroadcastOrigin()', historian.hasBroadcastOrigin()); | ||
} | ||
); | ||
}; | ||
this.HistorianTest.prototype.testBroadcastOriginSetFalse = function(queue) { | ||
queuedRequire( | ||
queue, | ||
[ | ||
'antie/historian' | ||
], | ||
function(Historian) { | ||
var historian = new Historian('http://www.test.com/test/#&*history=http://www.test2.com'); | ||
assertFalse('hasBroadcastOrigin()', historian.hasBroadcastOrigin()); | ||
} | ||
); | ||
}; | ||
}()); |
@@ -499,2 +499,12 @@ /** | ||
/** | ||
* Returns a Boolean value to indicate whether the application has a parameter in its URL indicating | ||
* it was launched with broadcast trust. Use isBroadcastSourceSupported() on {@link antie.devices.Device} | ||
* to see whether a broadcast API is also available for your device. | ||
* @returns {Boolean} True if the URL query contains a broadcast=true entry. | ||
*/ | ||
hasBroadcastOrigin: function () { | ||
return this.getCurrentAppURLParameters().broadcast === 'true'; | ||
}, | ||
/** | ||
* Exits the application by using the configured exit strategy for the device, even if there is a parent TAL | ||
@@ -505,3 +515,3 @@ * application in the history stack. Will exit to broadcast if the first TAL application was launched from | ||
exit: function exit () { | ||
if (this.getDevice().getHistorian().hasBroadcastOrigin()) { | ||
if (this.hasBroadcastOrigin()) { | ||
this.getDevice().exitToBroadcast(); | ||
@@ -508,0 +518,0 @@ } else { |
@@ -118,4 +118,3 @@ /** | ||
Device.prototype.isBroadcastSourceSupported = function() { | ||
// we should consider alternatives to using hash fragment | ||
return this.getHistorian().hasBroadcastOrigin(); | ||
return RuntimeContext.getCurrentApplication().hasBroadcastOrigin(); | ||
}; | ||
@@ -122,0 +121,0 @@ |
@@ -273,3 +273,3 @@ /** | ||
Device.prototype.isBroadcastSourceSupported = function() { | ||
return this.getHistorian().hasBroadcastOrigin(); | ||
return RuntimeContext.getCurrentApplication().hasBroadcastOrigin(); | ||
}; | ||
@@ -276,0 +276,0 @@ |
@@ -120,16 +120,8 @@ /** | ||
/** | ||
* Returns a Boolean to indicate whether the history stack contains valid return URLs. This excludes the 'return to broadcast' special case. | ||
* Returns a Boolean to indicate whether the history stack contains valid return URLs. | ||
* @returns {Boolean} True if the history stack contains one or more valid return URLs. | ||
*/ | ||
hasHistory: function hasHistory () { | ||
var historyMinimumLength = this.hasBroadcastOrigin() ? 2 : 1; | ||
var historyMinimumLength = 1; | ||
return this._historyArray.length >= historyMinimumLength; | ||
}, | ||
/** | ||
* Returns a Boolean to indicate whether the first entry in the history stack is the special 'broadcast' entry. | ||
* @returns {Boolean} True if the first entry in the history stack is the special 'broadcast' entry. | ||
*/ | ||
hasBroadcastOrigin: function hasBroadcastOrigin () { | ||
return this._historyArray.length > 0 && this._historyArray[this._historyArray.length - 1] === Historian.HISTORY_TOKEN + Historian.BROADCAST_ENTRY; | ||
} | ||
@@ -140,3 +132,2 @@ }); | ||
Historian.ROUTE_TOKEN = '&*route='; | ||
Historian.BROADCAST_ENTRY = 'broadcast'; | ||
@@ -143,0 +134,0 @@ return Historian; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
4
3880626
98870