Skip to content

Commit

Permalink
Closed #1 again.
Browse files Browse the repository at this point in the history
  • Loading branch information
oldestlivingboy committed Jun 13, 2016
1 parent e855494 commit 052b925
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 32 deletions.
Binary file modified builds/hardenedpaste.nex
Binary file not shown.
Binary file modified builds/hardenedpaste.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion opera/chrome/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Hardened Paste",
"version": "1.1.0",
"version": "1.2.0",
"description": "Prevent the “pastejacking” browser exploit.",
"icons": {"48": "images/48.png", "128": "images/128.png"},
"permissions": ["<all_urls>", "contextMenus", "gcm", "notifications", "tabs"],
Expand Down
34 changes: 18 additions & 16 deletions opera/chrome/scripts/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,37 +36,39 @@ new MutationObserver(function(mutations) {
(document.body || root).appendChild(showIndicator);
inlineShim.textContent =
'var inliningAllowed = document.createElement(\'input\');\n\
var _addEventListener = EventTarget.prototype.addEventListener;\n\
var _execCommand = HTMLDocument.prototype.execCommand;\n\
var showIndicator =\n\
document.getElementsByName(\'hardenedpaste-indicator\')[0];\n\
var _execCommand = document.execCommand;\n\
var _addEventListener = EventTarget.prototype.addEventListener;\n\
inliningAllowed.type = \'hidden\';\n\
inliningAllowed.name = \'hardenedpaste-inlining\';\n\
inliningAllowed.value = true;\n\
(document.body || document.documentElement).appendChild(inliningAllowed);\n\
\n\
HTMLDocument.prototype.execCommand =\n\
function(command, showUI, commandValue) {\n\
var returnValue;\n\
\n\
if (command == \'copy\' || command == \'cut\')\n\
showIndicator.value = true;\n\
else {\n\
_execCommand.call(document, command, showUI, commandValue);\n\
returnValue = true;\n\
}\n\
\n\
return returnValue;\n\
}\n\
\n\
EventTarget.prototype.addEventListener =\n\
function(type, listener, useCapture) {\n\
if (type == \'copy\')\n\
if (type == \'copy\' || type == \'cut\')\n\
_addEventListener.call(this, type, function() {\n\
showIndicator.value = true;\n\
});\n\
else _addEventListener.call(this, type, listener, useCapture);\n\
}\n\
\n\
DataTransfer.prototype.setData = function() { showIndicator.value = true; }\n\
\n\
document.execCommand = function(command, showUI, commandValue) {\n\
var returnValue;\n\
\n\
if (command == \'copy\') showIndicator.value = true;\n\
else {\n\
_execCommand.call(document, command, showUI, commandValue);\n\
returnValue = true;\n\
}\n\
\n\
return returnValue;\n\
}';
DataTransfer.prototype.setData = function() { showIndicator.value = true; }';
head.appendChild(inlineShim);

if (!document.getElementsByName('hardenedpaste-inlining')[0]) {
Expand Down
28 changes: 14 additions & 14 deletions opera/chrome/scripts/shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@
Brian Kennish <[email protected]>
*/
var _addEventListener = EventTarget.prototype.addEventListener;
var _execCommand = HTMLDocument.prototype.execCommand;
var showIndicator = document.getElementsByName('hardenedpaste-indicator')[0];
var _execCommand = document.execCommand;

EventTarget.prototype.addEventListener = function(type, listener, useCapture) {
if (type == 'copy')
_addEventListener.call(this, type, function() {
showIndicator.value = true;
});
else _addEventListener.call(this, type, listener, useCapture);
}

DataTransfer.prototype.setData = function() { showIndicator.value = true; }
var _addEventListener = EventTarget.prototype.addEventListener;

document.execCommand = function(command, showUI, commandValue) {
HTMLDocument.prototype.execCommand = function(command, showUI, commandValue) {
var returnValue;

if (command == 'copy') showIndicator.value = true;
if (command == 'copy' || command == 'cut') showIndicator.value = true;
else {
_execCommand.call(document, command, showUI, commandValue);
returnValue = true;
}

return returnValue;
}

EventTarget.prototype.addEventListener = function(type, listener, useCapture) {
if (type == 'copy' || type == 'cut')
_addEventListener.call(this, type, function() {
showIndicator.value = true;
});
else _addEventListener.call(this, type, listener, useCapture);
}

DataTransfer.prototype.setData = function() { showIndicator.value = true; }
2 changes: 1 addition & 1 deletion opera/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Hardened Paste",
"version": "1.1.0",
"version": "1.2.0",
"description": "Prevent the “pastejacking” browser exploit.",
"icons": {"48": "chrome/images/48.png", "128": "chrome/images/128.png"},
"developer": {"name": "Rocketship", "url": "https://rocketshipapps.com/"},
Expand Down

0 comments on commit 052b925

Please sign in to comment.