amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Require Layout Not Being Honored in Safari

Open glevitzky opened this issue 8 years ago • 8 comments

What's the issue?

Requesting layoutCallback to be triggered does not appear to work on iOS Safari. This was discovered while trying to figure out why refresh for ads is not working on the same browser.

How do we reproduce the issue?

  1. Pull down the glevitzky-request-layout branch and run gulp.
  2. In Chrome with dev console open, navigate to localhost:8000/examples/refresh.amp.html and observe the following within amp-a4a.js: a. Execution will pause due to debugger statement in layoutCallback. Press resume. b. Execution will pause (after a second or two) in refresh due to debugger statement. Observe that the three lines following the debugger statement set up the call for the next layoutcallback. Press resume. c. Execution will pause (after another second or two) in layoutCallback. This is the correct sequence of events.
  3. Now repeat step 2 in Safari. Observe that execution never pauses in layoutCallback after refresh, as if the requireLayout call is simply not honored in Safari.

What browsers are affected?

Safari

Which AMP version is affected?

This is happening in the current version, 1524489706901, and at least the preceding two versions before it.

glevitzky avatar Apr 23 '18 13:04 glevitzky

Dima, assigning this to you since you wrote the requireLayout code. Please reassign to someone more appropriate, if necessary.

glevitzky avatar Apr 25 '18 18:04 glevitzky

@lannka, @jridgewell could you ptal or reassign?

dvoytenko avatar Apr 30 '18 23:04 dvoytenko

This is not a Resources issue, I've verified everything inside Safari (it worked, once).

Rather, it appears to be a spotty keyset fetch. I can't understand it. It's literally a fetch('...keyset.json', opts) and it's never resolving.

jridgewell avatar May 01 '18 19:05 jridgewell

Promoting this to a P0 because, frankly, it scares me that Safari would fail to resolve a fetch's promise. We really need to figure out what the hell is going on, and whether we need to fall back on Polyfills in Safari (which would be a major drag).

jridgewell avatar May 01 '18 20:05 jridgewell

Not a P0, whoo.

This is looks to be because one of your timers trips due to the debugger call in layoutCallback. If I disable breakpoints, reload, then enable the breakpoints after the ad renders, it hits the debugger in refresh.

Back to ads.

jridgewell avatar May 01 '18 22:05 jridgewell

It sounds like it still does not call layoutCallback a second time (which is the crux of the issue for me), is that correct? If so, do you have any ideas why that might be?

glevitzky avatar May 01 '18 22:05 glevitzky

I hit it every time.

There's an issue with this.friendlyIframeEmbed_.destroy() throwing because the node isn't attached, but that's not the same issue.

jridgewell avatar May 01 '18 22:05 jridgewell

Okay, that's good news. Thanks for testing, Justin.

glevitzky avatar May 02 '18 12:05 glevitzky