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

Unified Diff: include.preload.js

Issue 6317759025643520: Issue 1396 - Avoid infinite recursion when collapsing <input type="image"> elements (Closed)
Patch Set: Created Sept. 24, 2014, 11:09 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include.preload.js
===================================================================
--- a/include.preload.js
+++ b/include.preload.js
@@ -28,6 +28,13 @@
function checkCollapse(element)
{
+ // <input type="image"> elements try to load their image again
+ // when the "display" CSS property is changed by the
+ // collapsing code below. So we have to bail out, if collapsing
+ // is already in progress, to avoid an infinite recursion.
+ if (element._collapsing)
+ return;
Wladimir Palant 2014/09/24 14:57:00 Interesting, a load triggered for an element with
Thomas Greiner 2014/09/24 15:08:29 That's what I checked before and it does have the
Sebastian Noack 2014/09/24 16:42:40 The only thing the standard defines for that parti
Sebastian Noack 2014/09/24 17:04:58 Done, though it wasn't actually that simply. I als
+
var tag = element.localName;
if (tag in typeMap)
{
@@ -47,6 +54,8 @@
{
if (response && element.parentNode)
{
+ element._collapsing = true;
Thomas Greiner 2014/09/24 12:35:32 This makes us quite easily distinguishable from ot
Sebastian Noack 2014/09/24 12:50:09 No, it doesn't. Content scripts run in a different
Thomas Greiner 2014/09/24 14:14:54 I can confirm that custom properties are not part
+
// <frame> cannot be removed, doing that will mess up the frameset
if (tag == "frame")
element.style.setProperty("visibility", "hidden", "important");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld