Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include.postload.js

Issue 5088751004942336: Issue 370 - Right-clicked element is removed independent of created filter (Closed)
Patch Set: Created Jan. 10, 2014, 10:27 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« block.js ('K') | « block.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include.postload.js
===================================================================
--- a/include.postload.js
+++ b/include.postload.js
@@ -511,7 +511,7 @@
clickHide_deactivate();
break;
case "clickhide-new-filter":
- // The request is received by all frames, so ignore it if we're not the frame the
+ // The message is received by all frames, so ignore it if we're not the frame the
// user right-clicked in
if(!lastRightClickEvent)
return;
@@ -542,7 +542,7 @@
// Following test will be true if we found the element with the filter URL
if(msg.filter === url)
{
- // This request would have come from the chrome.contextMenu handler, so we
+ // This message would have come from the chrome.contextMenu handler, so we
// simulate the user having chosen the element to get rid of via the usual means.
clickHide_activated = true;
// FIXME: clickHideFilters is erased in clickHide_mouseClick anyway, so why set it?
@@ -555,7 +555,7 @@
clickHide_mouseClick(lastRightClickEvent);
}
else
- console.log("clickhide-new-filter: URLs don't match. Couldn't find that element.", request.filter, url, lastRightClickEvent.target.src);
+ console.log("clickhide-new-filter: URLs don't match. Couldn't find that element.", msg.filter, url, lastRightClickEvent.target.src);
break;
case "clickhide-init":
if (clickHideFiltersDialog)
@@ -570,16 +570,25 @@
case "clickhide-move":
if (clickHideFiltersDialog)
{
- clickHideFiltersDialog.style.left = (parseInt(clickHideFiltersDialog.style.left, 10) + request.x) + "px";
- clickHideFiltersDialog.style.top = (parseInt(clickHideFiltersDialog.style.top, 10) + request.y) + "px";
+ clickHideFiltersDialog.style.left = (parseInt(clickHideFiltersDialog.style.left, 10) + msg.x) + "px";
+ clickHideFiltersDialog.style.top = (parseInt(clickHideFiltersDialog.style.top, 10) + msg.y) + "px";
}
break;
case "clickhide-close":
if (clickHideFiltersDialog)
Wladimir Palant 2014/01/10 16:28:56 You should add |&& currentElement| check here whic
{
// Explicitly get rid of currentElement
- if (msg.remove && currentElement && currentElement.parentNode)
- currentElement.parentNode.removeChild(currentElement);
+ var element = currentElement;
+ ext.backgroundPage.sendMessage({
+ type: "should-collapse",
+ url: element.src,
+ documentUrl: document.URL,
+ mediatype: typeMap[element.localName]
+ }, function(response)
+ {
+ if (response && element.parentNode)
+ element.parentNode.removeChild(element);
+ });
Wladimir Palant 2014/01/10 16:28:56 What if an element hiding filter was added? Not on
Sebastian Noack 2014/06/25 16:40:59 The problem is not (only) that the element is remo
Wladimir Palant 2014/06/25 18:49:34 We don't care, going through the entire document l
Sebastian Noack 2014/06/25 19:05:05 Actually we exactly do that already, when the matc
Thomas Greiner 2014/07/17 15:35:49 This issue only addresses the case when a filter d
Wladimir Palant 2014/07/17 15:55:10 That would be the best solution. If that's too com
clickHide_deactivate();
}
« block.js ('K') | « block.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld