Commit graph

325 commits

Author SHA1 Message Date
yvt
3090505fd4 refactor(script): navigate_or_reload_child_browsing_context should only handle cases involving navigation
The initial document creation does not involve navigation, and it would
cause a confusion if this was done by a function which has `navigation`
in its name. This commit renames `navigate_or_reload_child_browsing_
context` to `start_new_pipeline`, and introduces a new function which
has the original name and is dedicated to handle navigation.
2021-08-03 09:11:19 +09:00
Jonathan Kingston
0e1479cc84 Add creation url and Secure Contexts 2020-11-25 18:30:50 +00:00
Vincent Ricard
2a4dd894de Implement DOMTokenList.supports API 2020-10-05 09:26:36 +02:00
Utsav Oza
acbfd7b9ab Do not load srcdoc iframes synchronously 2020-08-05 18:44:28 +05:30
Matthias Deiml
fa18cf620f Make url for "client" referrer mandatory 2020-06-17 19:07:14 +02:00
Anthony Ramine
5ff931d171 Introduce <LayoutDom<Element>>::attrs()
This safe method is the basic block to access element attributes from layout.
We reuse it in the other attr-related layout methods to remove a pretty big
source of rampant unsafe code between script and layout.
2020-03-31 18:46:49 +02:00
Anthony Ramine
0bda174823 Merge RawLayoutElementHelpers into LayoutElementHelpers 2020-03-31 18:30:42 +02:00
Anthony Ramine
1504f35031 Make HTMLIFrameElementLayoutMethods methods take self 2020-03-29 17:19:59 +02:00
Anthony Ramine
dba6a635e5 Give a lifetime parameter to LayoutDom 2020-03-28 15:37:57 +01:00
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function 2020-03-20 22:16:56 -04:00
bors-servo
dae49435c2
Auto merge of #25668 - pshaughn:iframerecursion, r=jdm
Stop iframes from including their ancestors

An iframe that included itself would just keep loading until running out of resources; the spec includes protection against that, and now Servo follows (some of) the spec about it.

---
<!-- 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 the same-origin case presented in #3931 but not a case in which an intermediate cross-origin iframe is hiding a same-origin ancestor further up.
<!-- Either: -->
- [X] There is a manual test for these changes in #3931

<!-- 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. -->
2020-02-24 15:20:50 -05:00
Patrick Shaughnessy
f29e22f131 Names should now be consistently atoms 2020-02-13 11:21:46 -05:00
Patrick Shaughnessy
89384ffec3 Iframes can't include an ancestor they know about 2020-02-12 16:22:27 -05:00
Josh Matthews
af158de504 dom: Reduce the scope of iframe's load blocker borrow. 2019-11-12 13:57:54 -05:00
jaymodi98
bf69b6fea7 Implement srcdoc support for iframes. 2019-11-12 13:57:54 -05:00
Josh Matthews
91dfa354b1 Ensure layout/script always have a correct viewport size when a new pipeline is created. 2019-11-06 16:13:55 -05:00
Josh Matthews
fd260f78c8 dom: Calculate the viewport size of iframes when they are first added to the tree. 2019-11-06 16:13:55 -05:00
Gregory Terzian
45ec250b0a improve spec compliance of discarding BCs
do not handle compositor input events when BC is being discarded

prevent firing of timers for discarded BCs

return null for opener is BC has been discarded

bundle discard BC steps into window method

return null in window.opener, if BC has already been discarded

move the window closed check pre-event to script-thread
2019-09-22 12:46:40 +08:00
Gregory Terzian
8482d2e781 restructure content process shutdown ack with threaded sender, without layout 2019-08-17 16:03:07 +02:00
Emilio Cobos Álvarez
3d57c22e9c Update euclid.
There are a few canvas2d-related dependencies that haven't updated, but they
only use euclid internally so that's not blocking landing the rest of the
changes.

Given the size of this patch, I think it's useful to get this landed as-is.
2019-07-23 23:09:55 +02:00
Gregory Terzian
571beec179 clean-up navigation
security: check target and source origin before executing JS url

implement replacement-enabled flag as a HistoryEntryReplacement enum

add source origin string on loaddata

add LoadOrigin

iframe: remove optional load-data

auxiliaries: add load-data into info

constellation: remove url from Pipeline::new

check load origin: link to whatwg issue

switch loadorigin toplevel to constellation
2019-07-18 12:03:45 +08:00
Fernando Jiménez Moreno
813b242419 Introduce BindContext with in_doc and connected flags
Fix some is_in_doc -> is_connected mistakes
2019-04-26 11:31:18 +02:00
Fernando Jiménez Moreno
441357b74e Add is_connected flag to node and use it to replace most uses of is_in_doc 2019-04-26 10:17:45 +02:00
Russell Cousineau
2440e0f98a set referrer in window.load_url
- this conforms to follow-hyperlinks spec step 13
- this conforms to window-open spec step 14.3
- replace uses of `referrer_url` with `referrer`
- in Request class, change "no-referrer" to ""
- set websocket fetch referrer to "no-referrer"
2019-04-19 16:50:38 -07:00
Aron Zwaan
39c652ed13 Remove SetVisible message from iframe 2019-03-12 11:26:41 +01:00
Josh Matthews
c2ce7d72a1 Make nested browsing context navigations check the loaded status of the active document of the nested browsing context. 2019-03-07 19:01:54 -05:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
bors-servo
66223ee105
Auto merge of #22121 - gterzian:remove_constellation_block_in_navigation, r=paulrouget
Remove sync constellation -> embedder communication

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #22042 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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/22121)
<!-- Reviewable:end -->
2018-12-26 01:53:20 -05:00
Emilio Cobos Álvarez
006e71c7de style: Make Servo use a single thread-pool for layout-related tasks per-process.
Instead of per-document. This also allows to reuse this thread-pool if needed
for other stuff, like parallel CSS parsing (#22478), and to share more code with
Gecko, which is always nice.
2018-12-23 13:00:56 +01:00
Gregory Terzian
eb82e781a3 implement windowproxy "delay-load-event-mode", and partially document "completely-loaded" 2018-12-23 17:39:13 +08:00
bors-servo
27577955aa
Auto merge of #22456 - dlrobertson:fix_src, r=ferjm
Update src/href attributes to be a USVString

The following IDLs have the src/href attributes typed as a `DOMString`
while in the spec the attribute has been updated to be a `USVString`:

 - [HTMLIFrameElement]
 - [HTMLImageElement]
 - [HTMLInputElement]
 - [HTMLLinkElement]
 - [HTMLMediaElement]
 - [HTMLScriptElement]

Fixes: #22454

[HTMLIFrameElement]: https://html.spec.whatwg.org/multipage/#htmliframeelement
[HTMLImageElement]: https://html.spec.whatwg.org/multipage/#htmlimageelement
[HTMLInputElement]: https://html.spec.whatwg.org/multipage/#htmlinputelement
[HTMLLinkElement]: https://html.spec.whatwg.org/multipage/#htmllinkelement
[HTMLMediaElement]: https://html.spec.whatwg.org/multipage/#htmlmediaelement
[HTMLScriptElement]: https://html.spec.whatwg.org/multipage/#htmlscriptelement

<!-- 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/22456)
<!-- Reviewable:end -->
2018-12-22 23:50:40 -05:00
Dan Robertson
c46508e497
Update src/href attributes to be a USVString
The following IDLs have the src/href attributes typed as a DOMString
while in the spec the attribute has been updated to be a USVString:

 - HTMLIFrameElement
 - HTMLImageElement
 - HTMLInputElement
 - HTMLLinkElement
 - HTMLMediaElement
 - HTMLScriptElement
2018-12-17 15:28:42 +00:00
Josh Matthews
fc2d810bce Delay iframe and script element processing until the DOM is stable. 2018-12-14 13:12:49 -05:00
Josh Matthews
231a37be24 Initial window sizes are mandatory. 2018-12-14 13:12:46 -05:00
Josh Matthews
34e77f62af Ensure that all new iframes have a correct initial window size. 2018-12-14 13:00:47 -05:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Agustin Chiappe Berrini
75eb94afca Unify the task source and task canceller API
I moved away from the `Window` struct all the logic to handle task
sources, into a new struct called `TaskManager`. In a happy world, I'd
be able to just have there two functions, of the types:

```rust
fn task_source<T: TaskSource>(&self, name: TaskSourceName) -> Box<T>
fn task_source_with_canceller<T: TaskSource>(&self, name: TaskSourceName)
  -> (Box<T>, TaskSourceCanceller)
```

And not so much duplicated code. However, because TaskSource can't be a
trait object (because it has generic type parameters), that's not
possible. Instead, I decided to reduce duplicated logic through macros.

For reasons[1], I have to pass both the name of the function with
canceller and the name of the function without, as I'm not able to
concatenate them in the macro itself. I could probably use
`concat_idents` to create both types already defined and reduce the
amount of arguments by one, but that macro is nightly only. At the same
time, not being able to declare macros inside `impl` forces me to pass
`self` as an argument.

All this makes this solution more verbose than it would be ideally. It
does reduce duplication, but it doesn't reduce the size of the file.

[1](https://github.com/rust-lang/rust/issues/29599)
2018-11-14 06:36:44 -05:00
Simon Sapin
2012be4a8b cargo fix --edition-idioms 2018-11-08 09:28:00 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Simon Sapin
76e59a46d3 Sort use statements 2018-11-06 15:26:02 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00
Michael Howell
eafcd91760 Assign a name to iframes when loading the initial about:blank
Before, it would assign the name too late,
causing scripts (which will not wait for another tick)
to accidentally spawn pop-up windows instead of loading
into the iframe.
2018-10-19 00:21:06 +00:00
chansuke
c37a345dc9 Format script component 2018-09-19 17:40:47 -04:00
Gregory Terzian
a0082c57c8 iframe: use value of name attr to set nested bc name 2018-08-11 01:13:11 +02:00
Gregory Terzian
21bf5a3a4b implement opener, disowning 2018-08-11 01:13:11 +02:00
Connor Brewster
5f85824ab3 Replace initial about:blank loads 2018-04-11 09:51:22 -05:00
Nakul Jindal
7d4e2b11e9 Implements profiler for blocked recv 2018-03-22 11:48:27 -07:00
paavininanda
b9f7aa4686 Adding Name and SetName functions for window 2018-02-26 07:38:41 +05:30
Paul Rouget
da349ee8a9 remove mozbrowser code 2018-02-13 09:40:06 +01:00