Browse Source

re #61

pull/2/head
Raymond Hill 10 years ago
parent
commit
238e6c3536
  1. 20
      src/js/contentscript-start.js

20
src/js/contentscript-start.js

@ -151,10 +151,10 @@ var navigatorSpoofer = " \
return; \
} \
var realNavigator = navigator; \
var SpoofedNavigator = function(ua) { \
var SpoofedNavigator = function() { \
this.navigator = navigator; \
}; \
var spoofedNavigator = new SpoofedNavigator(spoofedUserAgent); \
var spoofedNavigator = new SpoofedNavigator(); \
var makeFunction = function(n, k) { \
n[k] = function() { \
return this.navigator[k].apply(this.navigator, arguments); }; \
@ -170,7 +170,9 @@ var navigatorSpoofer = " \
var pos = spoofedUserAgent.indexOf('/'); \
spoofedNavigator.appName = pos < 0 ? '' : spoofedUserAgent.slice(0, pos); \
spoofedNavigator.appVersion = pos < 0 ? spoofedUserAgent : spoofedUserAgent.slice(pos + 1); \
navigator = window.navigator = spoofedNavigator; \
/* console.log('umatrix 1: spoofedNavigator.userAgent = %s', spoofedNavigator.userAgent); */ \
window.navigator = navigator = spoofedNavigator; \
/* console.log('umatrix 2: navigator.userAgent = %s', navigator.userAgent); */ \
} catch (e) { \
} \
})();";
@ -203,6 +205,10 @@ var injectNavigatorSpoofer = function(spoofedUserAgent) {
}
catch (e) {
}
// The port will never be used again at this point, disconnecting allows
// to browser to flush this script from memory.
messaging.stop();
};
var requestDetails = {
@ -214,14 +220,6 @@ messaging.ask(requestDetails, injectNavigatorSpoofer);
/******************************************************************************/
/******************************************************************************/
// The port will never be used again at this point, disconnecting allows
// to browser to flush this script from memory.
messaging.stop();
/******************************************************************************/
/******************************************************************************/
})();
/******************************************************************************/
Loading…
Cancel
Save