mirror of
https://github.com/wassname/RubberGlove.git
synced 2026-06-27 16:59:06 +08:00
Reworked to remove synchronous XHR from content script for better performance.
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script src="/js/options.js"></script>
|
<script src="/js/popup.js"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="/css/options.css">
|
<link rel="stylesheet" type="text/css" href="/css/popup.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<a href="bitcoin:14B7hKTgSRKQewJbj8YQLy3nJ7QL36LBJT" target="_blank"><img src="/images/bitcoindonate.png" class="donateButton" /></a>
|
<a href="https://coinbase.com/checkouts/0ec4a16aa8227d3a43e4e200a79b55c5" target="_blank"><img src="/images/bitcoindonate.png" class="donateButton" /></a>
|
||||||
<img src="/images/icon64.png" class="extensionIcon" />
|
<img src="/images/icon64.png" class="extensionIcon" />
|
||||||
<div class="extensionTitle">
|
<div class="extensionTitle">
|
||||||
<span>RubberGlove</span>
|
<span>RubberGlove</span>
|
||||||
@@ -18,7 +18,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a href="https://www.panopticlick.com/" target="_blank">Visit panopticlick.com to see it in action.</a>
|
<p style="text-align: center;">
|
||||||
|
<a href="https://panopticlick.eff.org/" target="_blank">Visit panopticlick.eff.org to see it in action.</a></br>
|
||||||
|
<a href="http://cdn.rawgit.com/jsclary/RubberGlove/master/bomViewer/index.html" target="_blank">View your Browser Object Model.</a>
|
||||||
|
</p>
|
||||||
<p>Third-party cookies make fingerprinting unecessary. Disable third-party cookies in Chrome's privacy settings.</p>
|
<p>Third-party cookies make fingerprinting unecessary. Disable third-party cookies in Chrome's privacy settings.</p>
|
||||||
<p>Plugins including Flash, Java, Quicktime and Silverlight expose additional information that's difficult to block. Plugins should be set to "Click to play" or disabled to minimize exposure.</p>
|
<p>Plugins including Flash, Java, Quicktime and Silverlight expose additional information that's difficult to block. Plugins should be set to "Click to play" or disabled to minimize exposure.</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
window.navigator = window.clientInformation = function() {
|
var bomOverloadFunction = function() {
|
||||||
var oldNavigator = navigator;
|
var oldNavigator = navigator;
|
||||||
var altNav = {};
|
var altNav = {};
|
||||||
var propertyNames = Object.getOwnPropertyNames(oldNavigator);
|
var propertyNames = Object.getOwnPropertyNames(oldNavigator);
|
||||||
@@ -113,10 +113,4 @@ window.navigator = window.clientInformation = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return altNav;
|
return altNav;
|
||||||
}();
|
|
||||||
|
|
||||||
if(document.currentScript.id == '_RubberGlove_removeHead') {
|
|
||||||
document.currentScript.parentNode.parentNode.removeChild(document.currentScript.parentNode);
|
|
||||||
} else {
|
|
||||||
document.currentScript.parentNode.removeChild(document.currentScript);
|
|
||||||
}
|
}
|
||||||
+9
-17
@@ -1,20 +1,12 @@
|
|||||||
//console.log("RubberGlove: Content Script for " + window.location.href);
|
//console.log("RubberGlove: Content Script for " + window.location.href);
|
||||||
|
var compositeScript =
|
||||||
|
"window.navigator = window.clientInformation = (" + bomOverloadFunction.toString() + "());\n"
|
||||||
|
+ "(" + scriptCleanupFunction.toString() + "());";
|
||||||
|
|
||||||
function loadScript(name) {
|
var pageScript = document.createElement('script');
|
||||||
var request = new XMLHttpRequest();
|
pageScript.type = 'text/javascript';
|
||||||
request.open('GET', chrome.runtime.getURL(name), false);
|
pageScript.async = false;
|
||||||
request.send(null);
|
pageScript.text = compositeScript;
|
||||||
if (request.status === 200) {
|
|
||||||
return request.responseText;
|
|
||||||
}
|
|
||||||
console.error("RubberGlove: Failed to load " + name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var pageScripts = document.createElement('script');
|
|
||||||
pageScripts.type = 'text/javascript';
|
|
||||||
pageScripts.async = false;
|
|
||||||
pageScripts.text = loadScript("js/bomOverride.js");
|
|
||||||
|
|
||||||
var html = document.documentElement
|
var html = document.documentElement
|
||||||
var headTags = document.getElementsByTagName("head");
|
var headTags = document.getElementsByTagName("head");
|
||||||
@@ -22,7 +14,7 @@ var head = headTags.length > 0 ? head = headTags[0] : null;
|
|||||||
if(!head || head != html.firstChild) {
|
if(!head || head != html.firstChild) {
|
||||||
head = document.createElement('head');
|
head = document.createElement('head');
|
||||||
html.insertBefore(head, html.firstChild);
|
html.insertBefore(head, html.firstChild);
|
||||||
pageScripts.id = "_RubberGlove_removeHead";
|
pageScript.id = "_RubberGlove_removeHead";
|
||||||
}
|
}
|
||||||
window.addEventListener("message", function(event) {
|
window.addEventListener("message", function(event) {
|
||||||
if(event.source != window) return;
|
if(event.source != window) return;
|
||||||
@@ -34,4 +26,4 @@ window.addEventListener("message", function(event) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
head.insertBefore(pageScripts, head.firstChild);
|
head.insertBefore(pageScript, head.firstChild);
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
var scriptCleanupFunction = function() {
|
||||||
|
if(document.currentScript.id == '_RubberGlove_removeHead')
|
||||||
|
document.currentScript.parentNode.parentNode.removeChild(document.currentScript.parentNode);
|
||||||
|
else
|
||||||
|
document.currentScript.parentNode.removeChild(document.currentScript);
|
||||||
|
}
|
||||||
+14
-7
@@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "RubberGlove",
|
"name": "RubberGlove",
|
||||||
|
"short_name": "RubberGlove",
|
||||||
|
"version": "14.7.7.2",
|
||||||
"author": "Jason S. Clary",
|
"author": "Jason S. Clary",
|
||||||
"description": "Blocks common browser fingerprint techniques to improve your privacy.",
|
"description": "Blocks common browser fingerprint techniques to improve your privacy.",
|
||||||
"version": "14.7.7.1",
|
|
||||||
"icons": {
|
"icons": {
|
||||||
"16": "images/icon16.png",
|
"16": "images/icon16.png",
|
||||||
"19": "images/icon19.png",
|
"19": "images/icon19.png",
|
||||||
@@ -14,8 +15,17 @@
|
|||||||
},
|
},
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
"matches": [ "*://*/*", "https://*/*", "file://*/*" ],
|
"matches": [
|
||||||
"js": ["js/injectScripts.js"],
|
"http://*/*",
|
||||||
|
"https://*/*",
|
||||||
|
"file://*/*",
|
||||||
|
"ftp://*/*"
|
||||||
|
],
|
||||||
|
"js": [
|
||||||
|
"js/bomOverload.js",
|
||||||
|
"js/scriptCleanup.js",
|
||||||
|
"js/injectScripts.js"
|
||||||
|
],
|
||||||
"run_at": "document_start",
|
"run_at": "document_start",
|
||||||
"all_frames": true
|
"all_frames": true
|
||||||
}
|
}
|
||||||
@@ -26,14 +36,11 @@
|
|||||||
},
|
},
|
||||||
"browser_action": {
|
"browser_action": {
|
||||||
"default_icon": "images/icon19.png",
|
"default_icon": "images/icon19.png",
|
||||||
"default_popup": "html/options.html"
|
"default_popup": "html/popup.html"
|
||||||
},
|
},
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"tabs",
|
"tabs",
|
||||||
"privacy"
|
"privacy"
|
||||||
],
|
],
|
||||||
"web_accessible_resources": [
|
|
||||||
"js/bomOverride.js"
|
|
||||||
],
|
|
||||||
"incognito": "spanning"
|
"incognito": "spanning"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user