Commit graph

362 commits

Author SHA1 Message Date
Anthony Ramine
577370746e Rename DOMRefCell<T> to DomRefCell<T>
I don't want to do such a gratuitous rename, but with all the other types
now having "Dom" as part of their name, and especially with "DomOnceCell",
I feel like the other cell type that we already have should also follow
the convention. That argument loses weight though when we realise there
is still DOMString and other things.
2017-09-26 09:49:08 +02:00
Anthony Ramine
c52fd0a780 Rename MutNullableJS<T> to MutNullableDom<T> 2017-09-26 09:49:02 +02:00
Anthony Ramine
7be32fb237 Rename JS<T> to Dom<T> 2017-09-26 09:48:55 +02:00
Anthony Ramine
0e3c54c191 Rename dom::bindings::js to dom::bindings::root 2017-09-26 02:19:05 +02:00
Alan Jeffrey
fbfb9a80b4 Remove sources of panic when laying out an iframe without a nested browsing context. 2017-09-22 09:04:18 -05:00
Anthony Ramine
52527d6f9d Rename Task to TaskBox 2017-09-20 10:07:29 +02:00
Anthony Ramine
46628fba05 Move Task to its own module 2017-09-18 02:47:04 +02:00
Anthony Ramine
8e78f18d2d Introduce MainThreadScriptMsg::DispatchJobQueue
This removes the last remaining use of Task::run_with_script_thread
2017-09-17 10:46:00 +02:00
Anthony Ramine
1d52df0562 Remove uses of AsyncJobHandler from script_thread 2017-09-17 10:27:02 +02:00
Anthony Ramine
f58207b851 Introduce MainThreadScriptMsg::RegisterPaintWorklet
This avoids the need for a generic task to send messages to the layout thread
through the main script thread.
2017-09-17 10:19:59 +02:00
Anthony Ramine
56117d3185 Rename Runnable to Task
The changes are:
 * `*Runnable` -> `*Task`;
 * `RunnableMsg` -> `Task`;
 * `RunnableWrapper` -> `TaskCanceller`;
 * `MainThreadRunnable` -> `MainThreadTask`;
 * `wrap_runnable` -> `wrap_task`;
 * `get_runnable_wrapper` -> `task_canceller`;
 * `handler` -> `run`;
 * `main_thread_handler` -> `run_with_script_thread`.
2017-09-16 15:43:26 +02:00
Anthony Ramine
52a6f63608 Introduce MainThreadScriptMsg::MainThreadRunnable
This will allow us to separate the types for tasks that must run on the main
script thread and regular tasks.
2017-09-16 15:10:07 +02:00
Anthony Ramine
7ca52152a6 Put the name of runnables in Debug for CommonScriptMsg 2017-09-16 03:47:17 +02:00
Anthony Ramine
7481ce177f Store a Rc<MicrotaskQueue> directly on Window 2017-09-13 14:27:45 +02:00
Anthony Ramine
7f9f95b7ce Store microtask queues in Rc<T> 2017-09-13 14:27:42 +02:00
Anthony Ramine
fe29037e89 Avoid a clone in ScriptThread::new 2017-09-13 14:27:40 +02:00
bors-servo
40c8a6389a 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 -->
2017-09-09 04:39:43 -05:00
Anthony Ramine
0c33d6168e Panic from the default impl of Runnable::handler
This will allow us to make sure that tasks using main_thread_handler don't
actually get consumed through a call to the bare handler method.
2017-09-08 10:21:28 +02:00
Anthony Ramine
53d30d85b3 Reformat some task-related functions 2017-09-08 10:19:06 +02:00
Anthony Ramine
35a7252254 Kill UserInteractionTask
Just use a bare Runnable value.
2017-09-08 10:17:23 +02:00
Anthony Ramine
9252f2b8a2 Kill DOMManipulationTask
Just use a bare Runnable value.
2017-09-08 10:06:18 +02:00
Daniel Johnson
709cd3a0b6 "javascript:" urls: remove unnecessary block
Remove this block and unindent the code one level.

Doing this required cloning `load_data.url` so that we could
later mutate `load_data.url` in the same block.
2017-09-07 17:03:41 -07:00
Anthony Ramine
17a1dd9385 Kill Runnable::is_cancelled ⚔️ 2017-09-07 14:54:03 +02:00
Fernando Jiménez Moreno
fb843c251a Make Performance Timeline API work in Workers 2017-09-05 17:07:15 +02:00
toidiu
99e4504f85 move name implementation as default implementation to the trait and remove overrides. 2017-09-03 16:30:48 -04:00
toidiu
a3df0cf4de change function signature to get type name via intrinsics 2017-09-03 15:45:18 -04:00
Daniel Johnson
6ae6031468 "javascript:" urls: evaluate in iframe src attribute
- generalize the eval_js_url function so it can be called from
  multiple places.
- call it in htmliframeelement.
- if the js eval results in a non-string result, then it won't
  navigate to a new page, so don't block on the new page loading.
2017-08-28 22:22:39 -07:00
Daniel Johnson
5d28dd64d9 "javascript:" urls: clean up js evaluation code
- move it to its own function
- move the `url = "about:blank" code into the same block
- move the `use` statement to the top of the file
2017-08-28 12:57:38 -07:00
Daniel Johnson
ff786a050a "javascript:" urls: clean up after aborting a page load
Problem:
  After aborting on a 204 or 205 status code, you could no longer
  follow links on the page.

Cause:
  `constellation.rs` ignores new LoadUrl requests since the aborted
  one is in its `pending_changes` list.

Solution:
  Send a message to constellation that lets it clean up its
  `pending_changes` list.
2017-08-27 21:58:11 -07:00
Fernando Jiménez Moreno
2d0037f195 Add paint metrics to Performance Timeline API 2017-08-23 17:30:13 +02:00
Daniel Johnson
fa3e9ab244 "javascript:" urls: run in correct global
Make some changes to javascript scheme url evaluation to bring it
closer to
https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigating-across-documents

- Evaluate the js before the page load so that it happens in the
  correct `window` global.
- If the result is not a string, the response should be a 204.

This required saving some data in load_data, since it's not
possible to modify the response at the point where we're evaluating
the js.
2017-08-22 23:14:53 -07:00
Fernando Jiménez Moreno
1b123400eb Wait for actual paint before setting paint related metrics 2017-08-22 14:36:06 +02:00
Fernando Jiménez Moreno
52348f1fcc Performance Timeline API 2017-08-17 11:48:34 +02:00
Imanol Fernandez
703962fe61 Improve WebGL architecture. 2017-08-15 22:14:32 +02:00
bors-servo
74558990b2 Auto merge of #17425 - paulrouget:attach-pipeline-2, r=asajeffrey
cleanup embedder/compositor/constellation/script messages

Fix: #17226 #17200 #17201

This is work in progress. Some tests still fail.
I'd like to get early feedback as it's a pretty large PR.

There is nothing fundamentally new. Basically, I added TopLevelBrowsingContrextId to the relevant messages between the embedder, the compositor and the constellation, and enforced the PipelineId to be attached to each ScriptMsg (see #17201).

I unaliased all the ScriptMsg. It was getting difficult to understand the nature of the message as ScriptMsg was used aliased CompositorMsg sometimes (CompositorMsg is an actually type of message already). I renamed constellation_chan to script_to_constellation_chan, again, for clarification.

This cleanup code is necessary for #15934 and for tabs support.

/cc @asajeffrey can I ask you to look at this? No need for a formal review, I need feedback at this stage.

<!-- 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/17425)
<!-- Reviewable:end -->
2017-08-15 02:20:10 -05:00
Paul Rouget
d241389129 make use of ScriptToConstellationChan 2017-08-15 08:22:09 +02:00
Connor Brewster
e700006fb2 Handle exceptions during upgrades 2017-08-09 14:36:20 -06:00
Connor Brewster
e83a0045f9 Add upgrade reaction 2017-08-09 11:06:44 -06:00
Fernando Jiménez Moreno
892b30edca Implement basic Time To First Paint and First Contentful Paint PWMs 2017-07-20 15:41:21 +02:00
bors-servo
a6739cb17f Auto merge of #17761 - cbrewster:ce_reactions, r=jdm
Add [CEReactions] to webidls

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

---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [X] 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/17761)
<!-- Reviewable:end -->
2017-07-18 12:37:46 -07:00
bors-servo
eb26194dd1 Auto merge of #17735 - ferjm:navigationstart, r=jdm
Set navigation start value according to navigation timing spec

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #17651

<!-- 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/17735)
<!-- Reviewable:end -->
2017-07-18 10:24:44 -07:00
Fernando Jiménez Moreno
db044bdbef Set navigation start value according to navigation timing spec 2017-07-18 17:42:14 +02:00
Connor Brewster
438191e0b2 Implement CEReactions codegen 2017-07-18 08:18:22 -06:00
bors-servo
7b134440fc Auto merge of #17614 - cbrewster:custom_element_reactions, r=jdm
Implement custom element reactions

<!-- Please describe your changes on the following line: -->
Initial work for implementing custom element reactions: https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-reactions

---
<!-- 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 #17433 (github issue number if applicable).

<!-- Either: -->
- [X] 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/17614)
<!-- Reviewable:end -->
2017-07-17 22:58:53 -07:00
Connor Brewster
9b587a4f2d Invoke backup element queue via a microtask 2017-07-17 22:23:47 -06:00
Connor Brewster
4665991503 Support custom element callback reactions 2017-07-17 22:23:45 -06:00
bors-servo
2bb4f65100 Auto merge of #16508 - brainlessdeveloper:fetch-set-origin, r=asajeffrey
Properly set origin of fetch requests

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

These changes aim to fix #15247

---
<!-- 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 #15247 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes
- [x] These changes do not require tests because cors is already tested with different origins

These changes require changes in tests, but I need help with that (see comments below).

<!-- 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/16508)
<!-- Reviewable:end -->
2017-07-17 08:29:23 -07:00
Fausto Núñez Alberro
6032940fb8 Change RequestInit origin type to ImmutableOrigin 2017-07-16 21:44:33 +02:00
Alan Jeffrey
ef033b8362 Implemented paint worklet properties. 2017-07-11 17:28:56 -05:00
Imanol Fernandez
fe4ee6de2e WebVR 1.1 spec compatibility 2017-07-05 22:38:29 +02:00