-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Online iframe resizing rules with fallback. #790
Conversation
win.addEventListener('message', function(event) { | ||
if (event.origin != origin) { | ||
if (origin != '*' && event.origin != origin) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this? We should be able to calculate the origin of the iframe and only accept that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid races: How about tagging the message here as to whether it came from the active element?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about srcdoc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RE: races. Good idea. Will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With respect to srcdoc (which we currently don't support, but I'm working on right now) this is probably OK since we do check the source window.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"OK" as in let's keep ''? Or let's get origin from URL assuming that you will always convert srcdoc to a data URL? I likewise judged '' this to be ok since we always check on source window.
The latest push includes:
|
Scroll adjustment is removed from this PR. |
48ba020
to
60efa27
Compare
} | ||
}; | ||
this.blurCapture_ = e => { | ||
timer.delay(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. You need to document this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
LGTM |
The spec is changed to looking for |
I'd prefer resizable to be a bare attribute without any value. Otherwise LGTM |
newHeight: newHeight, | ||
force: force, | ||
fallback: fallback | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably not a part of our style guide but a nice to know, is ES2015 Object Literal Property Value Shorthand. (when key and the value have the same identifier)
this.changeHeightRequests_.push({
resource,
newHeight,
force,
fallback
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know. Do we have a compiler for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, this should work with babel-core (no helpers required). not sure if closure-compiler has support for it, which is why i hazard supporting us to use it 😸
@cramforce Yes, definitely makes sense. Switch to no-value attribute. |
8894606
to
339bafc
Compare
5501faa
to
69a4fbb
Compare
Online iframe resizing rules with fallback.
Hi, It seems if we leave out "allow-same-origin" from the sanbox policy, the iframe resize does not work at all. is there a workaround for this? please help! Thanks, |
@antipath Could you please file a separate bug for this since this is a closed pull request? |
Closes #728.
Still working on docs...