diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-09-09 04:39:43 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-09 04:39:43 -0500 |
commit | 40c8a6389afdad8fdffdf4a5616627f9a51b1822 (patch) | |
tree | 29694c5eea2b2066978b8e2b9cff019275b72b5b /components/script_traits/script_msg.rs | |
parent | c0c43da1f90afc37ac9d78bb7ef0f52cf02f2611 (diff) | |
parent | 452db052ff385e7abd112dec3b8147199b5d5b5f (diff) | |
download | servo-40c8a6389afdad8fdffdf4a5616627f9a51b1822.tar.gz servo-40c8a6389afdad8fdffdf4a5616627f9a51b1822.zip |
Auto merge of #17083 - danielj41:javascript-url-global-3, r=jdm
"javascript:" urls: execute in correct global scope
<!-- Please describe your changes on the following line: -->
#### Summary
This pull request makes `javascript:` urls execute in the correct global scope.
#### Example
```html
<script> var x = 4; </script>
<!-- this branch: logs "4" -->
<!-- master: undefined variable error -->
<a href="javascript:console.log(x)">link</a>
```
#### Questions
I'm new to servo and rust, so I'm unsure about these changes. In particular:
* What's the appropriate place to evaluate the js?
* I moved it to `handle_navigate`, but I'm not sure if this will catch all occurrences of `javascript:` urls. I also don't know if this will execute in the correct thread and the correct window.
* What should I do with the result of the js evaluation?
* I just ignored it. The previous behavior displayed it as the content of a new page load.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #15147, #16718
<!-- Either: -->
- [x] There are tests for these changes
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17083)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script_traits/script_msg.rs')
-rw-r--r-- | components/script_traits/script_msg.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index 30ae527562e..6ad93d922d4 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -99,6 +99,8 @@ pub enum ScriptMsg { /// A new load has been requested, with an option to replace the current entry once loaded /// instead of adding a new entry. LoadUrl(LoadData, bool), + /// Abort loading after sending a LoadUrl message. + AbortLoadUrl, /// Post a message to the currently active window of a given browsing context. PostMessage(BrowsingContextId, Option<ImmutableOrigin>, Vec<u8>), /// Dispatch a mozbrowser event to the parent of a mozbrowser iframe. |