Skip to content

Commit

Permalink
fix bug with list_preference_key
Browse files Browse the repository at this point in the history
  • Loading branch information
skepticfx committed Jun 9, 2015
1 parent b043597 commit 655d873
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/js/domHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ var domHooks = {
});
},

window_name: function() {
var original_window_name = window.name;
Object.defineProperty(window, "name", {
get: function() {
track.customHook.add(new Object({
'type': 'source',
'data': original_window_name,
'meta': functionCallTracer()
}), 'window_name');
return original_window_name;
}
});
},


document_cookie: function() {
var original_document_cookie = document.cookie;
Object.defineProperty(document, "cookie", {
Expand Down
6 changes: 6 additions & 0 deletions src/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var initializedDB = {
document_location_hash: [],
document_referrer: [],
document_cookie: [],
window_name: [],
window_eval: [],
document_write: [],
window_setTimeout: [],
Expand Down Expand Up @@ -33,6 +34,11 @@ var initializedDB = {
description: 'Hook document.referrer',
section: 'sources'
},
window_name: {
enabled: true,
description: 'Hook window.name',
section: 'sources'
},
document_cookie: {
enabled: true,
description: 'Hook document.cookie',
Expand Down
8 changes: 7 additions & 1 deletion src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ var addToTableBody = {
node.prepend('<tr><td><strong>' + htmlEscape(obj.name) + '</strong></td><td class="callStack" data-callStack="' + htmlEscape(obj.meta) + '">' + htmlEscape(obj.type) + '</td><td title="' + htmlEscape(obj.data) + '">' + this.stripped(htmlEscape(obj.data), 50) + '</td><td>' + htmlEscape(obj.href) + '</td></tr>');
},

window_name: function(obj, node) {
node.prepend('<tr><td><strong>' + htmlEscape(obj.name) + '</strong></td><td class="callStack" data-callStack="' + htmlEscape(obj.meta) + '">' + htmlEscape(obj.type) + '</td><td title="' + htmlEscape(obj.data) + '">' + this.stripped(htmlEscape(obj.data), 50) + '</td><td>' + htmlEscape(obj.href) + '</td></tr>');
},

document_referrer: function(obj, node) {
node.prepend('<tr><td><strong>' + htmlEscape(obj.name) + '</strong></td><td class="callStack" data-callStack="' + htmlEscape(obj.meta) + '">' + htmlEscape(obj.type) + '</td><td title="' + htmlEscape(obj.data) + '">' + this.stripped(htmlEscape(obj.data), 50) + '</td><td>' + htmlEscape(obj.href) + '</td></tr>');
},
Expand Down Expand Up @@ -204,7 +208,9 @@ function updateSectionTableBodyWithHooks(changes, db) {
Object.keys(hooks.newValue).forEach(function(hookName) {
if (hooks.newValue[hookName].length !== hooks.oldValue[hookName].length) {
var hookObject = hooks.newValue[hookName][hooks.newValue[hookName].length - 1];
if (db.settings.preferences[db.settings.hooks[hookObject.name].do_not_list_preference_key] === true) return;
if(db.settings.hooks[hookObject.name].do_not_list_preference_key !== undefined &&
db.settings.preferences[db.settings.hooks[hookObject.name].do_not_list_preference_key].enabled == true)
return;
var hookSectionName = backgroundPage.initializedDB.settings.hooks[hookObject.name].section;
if (hooks.oldValue[hookName].length === 0) $('#empty_section_table_body_' + hookSectionName).hide();
addToTableBody[hookObject.name](hookObject, $("#section_table_body_" + hookSectionName));
Expand Down

0 comments on commit 655d873

Please sign in to comment.