Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/playground: infinite loop in Edge and Firefox when embedded iframe styled with "display:none" #17199

Closed
jdalton opened this issue Sep 23, 2016 · 10 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@jdalton
Copy link

jdalton commented Sep 23, 2016

The while loop in fillOutLines of static/jquery-linedtextarea.js is
causing an infinite loop in Edge and Firefox browsers

The snippet is:

/*
 * Helper function to make sure the line numbers are always kept up to
 * the current system
 */
var fillOutLines = function(linesDiv, h, lineNo) {
  while (linesDiv.height() <= h) {
    linesDiv.append("<div>" + lineNo + "</div>");
    lineNo++;
  }
  return lineNo;
};
@bzbarsky
Copy link

bzbarsky commented Sep 23, 2016

I expect a simple test case is this:

<iframe style="display: none" src="https://play.golang.org/p/ZGmpjak_7O"></iframe>

or at least that certainly reproduces the problem in Firefox and I can't test Edge right this minute. The loop never terminates, because linesDiv.height() keeps returning 0.

@bradfitz
Copy link
Contributor

Can you give more details? It seems to work fine in Firefox for me.

What is different for you?

@bradfitz bradfitz added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Sep 23, 2016
@jdalton
Copy link
Author

jdalton commented Sep 23, 2016

@bradfitz

When the iframe containing the playground is hidden Edge/Firefox are reporting a height of 0 which is causing fillOutLines to get stuck in an infinite loop.

Try https://output.jsbin.com/zakenaf/1 (based on #17199 (comment)).
It hangs Edge and Firefox.

A falsey guard in the while expression may avoid problems:

var linesH;
while ((linesH=linesDiv.height()) && linesH <= h) {

@bradfitz
Copy link
Contributor

Do you have the wrong bug tracker? This is the Go bug tracker. If you have a jQuery bug, file against jQuery?

I'm not sure why you're linking to jsbin. How can I reproduce on https://play.golang.org/ with Firefox?

@jdalton
Copy link
Author

jdalton commented Sep 23, 2016

@bradfitz

If you view the source of the jsbin it is:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<iframe style="display: none" src="https://play.golang.org/p/ZGmpjak_7O"></iframe>
</body>
</html>

The script on play.golang.org, this https://play.golang.org/static/jquery-linedtextarea.js, is causing an infinite loop when the iframe of play.golang.org is hidden because it's computing a height of 0. The code lives on the golang playground.

It appears to be custom code adapted from others for use on play.golang.org so it doesn't look like a third-party bug. It looks like a play.golang.org bug.

@bradfitz
Copy link
Contributor

Okay, now we're getting to something that sounds like a bug report. You have to provide complete background info and repro steps. Jumping to saying what the fix is is useless if you don't identify the problem.

@jdalton
Copy link
Author

jdalton commented Sep 23, 2016

👏 Thank you!

@bradfitz bradfitz changed the title playground causes infinite loop in Edge and Firefox. x/tools/playground: infinite loop in Edge and Firefox when embedded iframe styled with "display:none" Sep 23, 2016
@bradfitz bradfitz removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Sep 23, 2016
@bradfitz bradfitz added this to the Go1.8 milestone Sep 23, 2016
@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 10, 2016
@gopherbot
Copy link

CL https://golang.org/cl/33151 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/33154 mentions this issue.

@broady
Copy link
Member

broady commented Nov 17, 2016

I thought I'd replied to this, but I guess it didn't come through.

This will go live once we release 1.8, in February. We can cherry-pick it to release branch 1.7 and deploy it if there's a good reason to do that.

@golang golang locked and limited conversation to collaborators Nov 17, 2017
@rsc rsc unassigned broady Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants