amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

All layouts reported us unsupported for amp-ad

Open tlong2 opened this issue 9 years ago • 5 comments

The isLayoutSupported function was removed from <amp-ad> in https://github.com/ampproject/amphtml/commit/980e7ca38269b695def57bf99e7a8abd58630b21. isLayoutSupported is apparently called before the element is upgraded meaning it falls back to the BaseElement version which is: isLayoutSupported(layout) { return layout == Layout.NODISPLAY; } Thus every type of <amp-ad> layout is considered invalid.

Was able to see this on http://amp.autoplaced.com.

tlong2 avatar Mar 17 '17 17:03 tlong2

Marking as a high priority for now. Having elements call #isLayoutSupported without first being upgraded feels like a potential catastrophe waiting to happen.

jridgewell avatar Mar 17 '17 17:03 jridgewell

Now I know why this feels so wrong to me, I had already opened an issue about it!

jridgewell avatar Mar 17 '17 17:03 jridgewell

Looking into this further:

This isn't widespread, because most of the time the implementation is still the ElementStub, which allows any layout type. I'm not entirely sure when the element get's upgraded from ElementStub to the correct (still not entirely upgraded) BaseElement implementation. Whenever we're in this state we have a real issue. Once it gets fully upgraded, we're back to normal behavior.

jridgewell avatar Mar 17 '17 17:03 jridgewell

@jridgewell Not yet exactly sure where this risk condition happens. But as a quick fix let's allow layouts ASAP.

dvoytenko avatar Mar 17 '17 17:03 dvoytenko

@tlong2 production was also patched by this fix. http://amp.autoplaced.com no longer produces those errors.

aghassemi avatar Mar 17 '17 20:03 aghassemi