File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,10 @@ function notifyDevtools(msgType, payload) {
4040 } ) ;
4141}
4242
43+ function isSolidus ( xpbHeader ) {
44+ return xpbHeader . match ( / S o l i d u s / i) ;
45+ }
46+
4347function getJsonResource ( tabID ) {
4448 chrome . tabs . get ( tabID , function ( tab ) {
4549 var jsonResourceURL = tab . url + '.json' ;
@@ -48,7 +52,7 @@ function getJsonResource(tabID) {
4852 xhr . onreadystatechange = function ( ) {
4953 if ( xhr . readyState !== 4 ) return ; //quickly return if not complete request
5054 var xpbHeader = xhr . getResponseHeader ( 'X-Powered-By' ) || 'unknown' ;
51- if ( ! xpbHeader . match ( / S o l i d u s / i ) ) { //quickly return if not solidus
55+ if ( ! isSolidus ( xpbHeader ) ) { //quickly return if not solidus
5256 notifyDevtools ( 'error' , 'No Solidus header detected.' ) ;
5357 notifyDevtools ( 'status' , '<b>not</b> running Solidus 0.1.7 or greater' ) ;
5458 notifyDevtools ( 'action' , 'shutdown' ) ;
Original file line number Diff line number Diff line change 1- describe ( "A suite" , function ( ) {
2- it ( "contains spec with an expectation" , function ( ) {
3- expect ( true ) . toBe ( true ) ;
1+ describe ( "Getting page context JSON" , function ( ) {
2+ it ( "Checks that header contains 'Solidus'" , function ( ) {
3+ var headerValue = isSolidus ( 'Solidus' ) ;
4+ expect ( headerValue ) . toBe ( true ) ;
45 } ) ;
5- } ) ;
6+ } ) ;
You can’t perform that action at this time.
0 commit comments