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

fix: IE bug when we're uploading from an iframe #876

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Nowadays
Copy link

@Nowadays Nowadays commented Jul 2, 2020

When using IE and iframes, if we upload a file from the iframe the File object is contructed using the window.parent.File, so checking value instanceof File yields false since it's the equivalent of doing value.constructor === window.File which also yields false since window.parent.File !== window.File

Note: if we're not in an iframe window.parent === window -> true, so no futher checking is necessary

@ygj6 ygj6 mentioned this pull request Jul 3, 2020
ygj6 pushed a commit that referenced this pull request Jul 3, 2020
@ygj6
Copy link
Collaborator

ygj6 commented Jul 3, 2020

I tested the scenario you said, the result is true,can you provide test cases
image

@Nowadays
Copy link
Author

Nowadays commented Jul 3, 2020

Just rechecked, this is an even worse edge case :

We're actually using a modal which holds the input that uploads the files in an iframe.

The issue is when you have a modal opened from the iframe BUT bound to the parent DOM (this is a technique to avoid weird issue with modal in iframes).

The issue is only in IE, chrome yields true on value instanceof File in the same scenario.

Sorry for not mentionning the modal, I didn't even think about that at first.

@ygj6 ygj6 mentioned this pull request Jul 4, 2020
@ygj6
Copy link
Collaborator

ygj6 commented Jul 4, 2020

Just rechecked, this is an even worse edge case :

We're actually using a modal which holds the input that uploads the files in an iframe.

The issue is when you have a modal opened from the iframe BUT bound to the parent DOM (this is a technique to avoid weird issue with modal in iframes).

The issue is only in IE, chrome yields true on value instanceof File in the same scenario.

Sorry for not mentionning the modal, I didn't even think about that at first.

I uploaded a use case to demonstrate this problem: examples/issues/pr876 But the result is true.

The picture below is the page I visited using IE11 browser, the button in the page opened a modal,there is an iframe in the modal box, there is an uploads input in the iframe, the final result is true

If I misunderstood what you meant, help improve this use case,thx.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants