-
Notifications
You must be signed in to change notification settings - Fork 10.3k
[XFA] Send URLs as strings, rather than objects (issue 1773) #13417
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
Conversation
0e1b329
to
76784fd
Compare
Note that `URL`s aren't supported by the structured clone algorithm, see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm, and any attempt to send a `URL` using `postMessage` is rejected by the browser. Hence, for consistency when workers are disabled, the `LoopbackPort` should obviously also reject any `URL`s.
76784fd
to
81ce28b
Compare
/botio unittest |
From: Bot.io (Linux m4)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.67.70.0:8877/d9a5b96498960ac/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_unittest from @Snuffleupagus received. Current queue size: 0 Live output at: http://3.101.106.178:8877/0658c37ac2de79b/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/d9a5b96498960ac/output.txt Total script time: 3.76 mins
|
From: Bot.io (Windows)SuccessFull output at http://3.101.106.178:8877/0658c37ac2de79b/output.txt Total script time: 5.19 mins
|
Given that `URL`s aren't supported by the structured clone algorithm, see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm, the document in issue 1773 will cause the browser to throw `DataCloneError: The object could not be cloned.`-errors and nothing will render. To fix this, we'll instead simply send the stringified version of the `URL` to prevent these errors from occuring.
81ce28b
to
ba13bd8
Compare
@@ -2257,7 +2257,7 @@ class Image extends StringObject { | |||
}; | |||
|
|||
if (this.href) { | |||
html.attributes.src = new URL(this.href); | |||
html.attributes.src = new URL(this.href).href; |
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.
I think that for now we shouldn't create an image in case of this.href !== null
:
- the ref can be a path (a name) to an internal picture which is not in the xml stream and we'll handle this case
- it can be a real
http://
link or whatever. In this case, what's the policy ? especially if the url has the file protocol. - it can be garbage as you saw it in the mentioned pdf.
And I've the same question fora
tag inxhtml.js
.
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.
The main objective of the PR was simply to avoid this line completely breaking everything, because of structured cloning errors (since a URL
can't be cloned), and further improvements can probably happen elsewhere?
- it can be a real
http://
link or whatever. In this case, what's the policy ? especially if the url has the file protocol.
I'm not sure that we should even attempt to support that case at all, given the possibly security implications of loading arbitrary content; this feels a bit similar to e.g. #13266 (comment).
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.
LGTM
Given that
URL
s aren't supported by the structured clone algorithm, see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm, the document in issue #1773 will cause the browser to throwDataCloneError: The object could not be cloned.
-errors and nothing will render.To fix this, we'll instead simply send the stringified version of the
URL
to prevent these errors from occuring.