Repository navigation
script: More faithfully implement "evaluate a JavaScript URL" - #47486
Conversation
|
This is a draft because it depends on #47485, but otherwise it is a three line fix that is reviewable as it is. |
| introduction_type: Option<&'static CStr>, | ||
| rval: Option<MutableHandleValue>, | ||
| ) -> Result<(), JavaScriptEvaluationError> { | ||
| assert!(self.can_run_script()); |
There was a problem hiding this comment.
I pushed back against this change in another PR because this check is intended to be a backstop. If we're hitting this assertion, I'd like to address the callers instead of silently ignoring the attempt to run script.
There was a problem hiding this comment.
Fair enough. I've taken a different approach here. Instead, I've more faithfully implemented the specification around "evaluate a JavaScript URL" which prevents evaluating a script as a side-effect of creating and running a classic script.
There was a problem hiding this comment.
I realized this comment was a bit confusing. What I meant to say is I rewrote the change after your comment above.
3cbc1aa to
2f9548a
Compare
evaluate_js_on_global cannot run script|
🔨 Triggering try run (#32783250714) for Linux (WPT) |
|
Let's see what the bots say about this new approach, I've kicked off a WPT job. |
|
Test results for linux-wpt from try job (#32783250714): Flaky unexpected result (28)
Stable unexpected results that are known to be intermittent (14)
Stable unexpected results (6)
|
|
|
|
Those are very promising results! |
This change makes it so that the "evaluate a JavaScript URL" procedure from the specification is more faithfully implemented. In particular, it builds and executes a classic script, which nows grows the ability to return a value, as specified. More specification steps are filled out in general. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2f9548a to
ec15fac
Compare
|
Okay. This one is ready for a review. |
| introduction_type: Option<&'static CStr>, | ||
| line_number: u32, | ||
| external: bool, | ||
| returns_a_value: bool, |
There was a problem hiding this comment.
Nit: introduce an enum ScriptReturnsAValue with members Yes and No. That way the code comments are unnecessary and the compiler will complain when the argument is accidentally used for external
There was a problem hiding this comment.
I've gone ahead and made a ScriptOptions bitflags struct to hold three of the boolean parameters passed to classic script creation. I think this simplifies the code a lot.
|
|
||
| // Step 13. Let finalSandboxFlags be policyContainer's CSP list's CSP-derived | ||
| // sandboxing flags. | ||
| load_data.creation_sandboxing_flag_set |= sandbox_flags; |
There was a problem hiding this comment.
I think the spec means this. Otherwise we might have discovered a spec bug?
| load_data.creation_sandboxing_flag_set |= sandbox_flags; | |
| load_data.creation_sandboxing_flag_set = sandbox_flags; |
There was a problem hiding this comment.
In fact, I think this line of code is completely wrong, because the specification talks about the "final sandbox flags", but I'm assigned the "creation sandbox flags" here. I've just removed this entirely.
|
Oh no, I just realized why these changes looked so familiar. I thought #46611 had already merged, but it hasn't yet and there's a huge amount of overlap. |
- Create a `ScriptOptions` to hold options passed to classic scripts - Respond to review comments - Make a variety of small comment / documentation improvements Signed-off-by: Martin Robinson <mrobinson@abandonedwig.info>
|
🔨 Triggering try run (#32815809600) for Linux (WPT) |
|
Test results for linux-wpt from try job (#32815809600): Flaky unexpected result (33)
Stable unexpected results that are known to be intermittent (13)
|
|
✨ Try run (#32815809600) succeeded. |
It's not merged, but i think that PR was addressing a separate issue that unnecessarily overlapped with this. I can rebase that after this, so it cleanly separates the two changes |
You must have looked at the comment I left which referenced a different issue before I edited it. #46611 is not merged. |
…47486) This change makes it so that the "evaluate a JavaScript URL" procedure from the specification is more faithfully implemented. In particular, it builds and executes a classic script, which nows grows the ability to return a value, as specified. More specification steps are filled out in general. Testing: This results in a progression on a decent number of WPT subtests. --------- Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@abandonedwig.info>
…47486) This change makes it so that the "evaluate a JavaScript URL" procedure from the specification is more faithfully implemented. In particular, it builds and executes a classic script, which nows grows the ability to return a value, as specified. More specification steps are filled out in general. Testing: This results in a progression on a decent number of WPT subtests. --------- Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@abandonedwig.info>
This change makes it so that the "evaluate a JavaScript URL" procedure
from the specification is more faithfully implemented. In particular, it
builds and executes a classic script, which nows grows the ability to
return a value, as specified. More specification steps are filled out in
general.
Testing: This results in a progression on a decent number of WPT subtests.