Add sanity checks

In rare circumstances, it's possible the content
script lose access to the background page, best
to check against this to avoid spurious console
errors.
This commit is contained in:
Raymond Hill 2019-09-29 12:26:58 -04:00
parent c95da8f5c5
commit bf99623a54
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -148,6 +148,7 @@ vAPI.SafeAnimationFrame = function(callback) {
vAPI.SafeAnimationFrame.prototype = {
start: function(delay) {
if ( vAPI instanceof Object === false ) { return; }
if ( delay === undefined ) {
if ( this.fid === undefined ) {
this.fid = requestAnimationFrame(( ) => { this.onRAF(); } );
@ -1454,7 +1455,8 @@ vAPI.bootstrap = (function() {
// to try bootstrapping again later.
const bootstrapPhase1 = function(response) {
if ( response === null ) { return; }
if ( response instanceof Object === false ) { return; }
vAPI.bootstrap = undefined;
// cosmetic filtering engine aka 'cfe'