Commit graph

103 commits

Author SHA1 Message Date
bors-servo
6d9b2eef29
Auto merge of #26943 - jdm:promise-incumbent, r=Manishearth
Fix panic on vimeo.com

The only time we end up enqueuing a promise reaction job with a null incumbent global argument is when SpiderMonkey does some weird stuff behind the scenes for its JS Debugger support (based on https://searchfox.org/mozilla-central/rev/2c1092dc68c63f7bad6da6a03c5883a5ab5ff2ca/js/src/builtin/Promise.cpp#3168). This commit works around that case and adds a regression test so we don't forget about that in the future.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26930
- [x] There are tests for these changes
2020-06-16 20:03:28 -04:00
Josh Matthews
2e4cee9971 dom: Avoid panic when SpiderMonkey enqueues dummy promise jobs. 2020-06-16 17:21:18 -04:00
Josh Matthews
83578265b4 Don't pretend we support SharedArrayBuffer. 2020-06-16 14:39:20 -04:00
Gregory Terzian
bd5796c90b integrate readablestream with fetch and blob 2020-06-04 11:38:35 +08:00
Simon Sapin
d103e06ba9 Use dynamic dispatch in mozjs::panic::wrap_panic
Pick up https://github.com/servo/rust-mozjs/pull/512

Fixes https://github.com/servo/servo/issues/26585

This diff is best viewed with "ignore whitespace changes", because of indentation change.
2020-05-25 20:34:05 +02:00
Kunal Mohan
39f336b527 Implement client-side logic for WebGPU id recycling 2020-05-22 21:22:19 +05:30
Alan Jeffrey
c611e46381 Remove WebVR 2020-04-08 20:23:41 -05:00
bors-servo
fd6f9140f7
Auto merge of #26056 - gterzian:enable_atomics_wait_on_dedicated_worker, r=jdm
Enable Atomics.wait in a dedicated worker agent

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

FIX #25191

---
<!-- 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 #___ (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. -->
2020-03-30 10:42:23 -04:00
Gregory Terzian
3ce6109836 enable Atomics.wait in a dedicated worker agent 2020-03-30 15:23:04 +08:00
Paul Rouget
5621c887fd Propagate user interacting flag to timers and promises 2020-03-26 08:36:57 +01:00
Anthony Ramine
5a4f8cf93f Update SpiderMonkey 2020-03-06 11:13:28 +01:00
CYBAI
403ffcf1eb Always pass InRealm to GlobalScope::from_context to avoid getting null global 2020-02-16 09:55:10 +09:00
Kunal Mohan
f7db4b7f80
Modify script to prevent further violations of snake_case 2020-01-18 14:22:15 +05:30
CYBAI
f2007751dd Scaffold module script 2020-01-03 13:02:31 +09:00
Patrick Shaughnessy
1506643f9a Now using eq_ignore_case on WASM mimetype, per #25317 2019-12-31 18:26:45 -05:00
Ridhim Rastogi
a5469f8710 Add StreamConsumer wrapper and methods to response 2019-12-03 15:59:35 -05:00
Josh Matthews
1c7f2d696c Remove use of deprecated language construct. 2019-11-26 21:54:33 -05:00
Josh Matthews
7944d9548c script: Ensure JS engine is initialized and deinitialized on the same thread. 2019-11-26 21:54:33 -05:00
Akash-Pateria
84f16eae98 Bind runnable dispatching in script_runtime 2019-11-19 23:25:52 -05:00
Ridhim Rastogi
563961826f Add consume stream callback 2019-11-11 16:48:52 -05:00
Ridhim Rastogi
9fb01e879b Add StreamConsumer wrapper and ReportStreamErrorCallback fn 2019-11-03 03:41:41 -05:00
Keith Yeung
c3b17c1201 begin messageport, transferable objects, impl
Accept transfer argument for StructuredCloneData::write

Allow structured clone reads to return a boolean

Add Transferable trait

Add basic skeletons to MessagePort

Implement transfer and transfer-receiving steps on MessagePort

Use transfer and transfer_receive in StructuredClone callbacks

Implement MessageChannel

Freeze the array object for the MessageEvent ports attribute

Implement transfer argument on window.postMessage

Use ReentrantMutex instead for MessagePortInternal

Accept origin as a parameter in dispatch_jsval

Fix BorrowMut crash with pending_port_message

Detach port on closure and check for detached during transfer

Enable webmessaging tests

fix webidl

fix
2019-10-19 14:12:22 +08:00
Josh Matthews
421001ae1a Work around crash on Windows when returning JS::Value by value. 2019-08-30 17:29:10 -07:00
bors-servo
90fb4c3589
Auto merge of #23930 - CYBAI:incumbent-global-assertion, r=jdm
Assert incumbent global is always some in get_incumbent_global hook

While working on module script, I'd like to use Promise with a custom
callback with type `Box<dyn TaskBox>` which means we didn't use web API
callbacks as native handlers. However, we'll get a panic from
`enqueue_promise_job` and the panic says we have a `null` incumbent
global. The main problem here is, the Promise API is strongly tied to JS
engine and it always assumes there's a meaningful answer for "what
specific global is this promise associated with". So, when I don't use
the Promise for a specific web API, our engine cannot find a proper
incumbent global for us so that we get the `null` incumbent global
panic.

To make us catch this case easier in the future, we should add the
assertion inside `get_incumbent_global` hook so that we can know this
quickly next time.

Ref: https://mozilla.logbot.info/servo/20190807#c16525481

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because it should just add assertion inside the hook

<!-- 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/23930)
<!-- Reviewable:end -->
2019-08-09 02:54:33 -04:00
marmeladema
6d444afd9e Use safe JSContext in MicrotaskQueue 2019-08-09 00:02:10 +01:00
marmeladema
51e22fbc26 Remove some usage of unsafe code in Promise 2019-08-09 00:02:07 +01:00
CYBAI
28e64fc701 Assert incumbent global is always some in get_incumbent_global hook
While working on module script, I'd like to use Promise with a custom
callback with type `Box<dyn TaskBox>` which means we didn't use web API
callbacks as native handlers. However, we'll get a panic from
`enqueue_promise_job` and the panic says we have a `null` incumbent
global. The main problem here is, the Promise API is strongly tied to JS
engine and it always assumes there's a meaningful answer for "what
specific global is this promise associated with". So, when I don't use
the Promise for a specific web API, our engine cannot find a proper
incumbent global for us so that we get the `null` incumbent global
panic.

To make us catch this case easier in the future, we should add the
assertion inside `get_incumbent_global` hook so that we can know this
quickly next time.

Ref: https://mozilla.logbot.info/servo/20190807#c16525481
2019-08-08 12:39:56 +09:00
marmeladema
88cacfb009 Modify *::get_cx methods to return a safe JSContext instead of a raw one 2019-07-24 09:53:10 +01:00
marmeladema
2fb3f1f983 Callbacks now uses safe JSContext instead of raw JSContext 2019-07-24 08:18:22 +01:00
marmeladema
dbcd8d7af2 Add safe JSontext wrapper around unsafe RawJSContext 2019-07-24 08:18:20 +01:00
marmeladema
5d85f60f7d Rename JSContext from js::jsapi to RawJSContext 2019-07-24 08:18:19 +01:00
Josh Matthews
63714c90fb Upgrade to Spidermonkey 67. 2019-06-26 18:10:46 -04:00
Josh Matthews
4328713f71 Update to SpiderMonkey 66. 2019-05-10 22:43:43 -04:00
Alan Jeffrey
5d7f238794 Fix debugmozjs build #23074 2019-05-06 16:24:42 -05:00
Peter Hall
8bfd4dc1e2 #8539 Config preferences backend restructure 2019-03-20 15:01:26 +00:00
Josh Matthews
367014a4ea Reintroduce parent runtimes for worker threads. 2019-01-15 14:00:13 -05:00
Josh Matthews
644101e1e4 Update to new JS runtime creation APIs. 2019-01-15 14:00:05 -05:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
bors-servo
a2937d9488
Auto merge of #21804 - AgustinCB:unify-task-source-canceller-api, r=gterzian
Unify the task source and task canceller API

To do so, I created a struct `TaskManagement(TaskSource,
TaskCanceller)` and made `*_task_source` return that instead of just
the task source.

Next, I refactored all places in which `task_canceller` by basically
removing them in favour of a previously called `*_task_source`.

I tried to make `task_canceller` a private method in `Window`, with the
hope of enforcing the use of `*_task_source`. However, it's used in
components/script/dom/globalscope.rs:575 in such a way that will make it
harder to avoid. I decided to leave it that way.

It'd be possible to unify `*_task_source` in such a way that we would
have only one method. However, I decided not to do it because one of the
`TaskSource` implementations is special:
`history_traversal_task_source`. Not wanting to over complicate things,
I decided to leave the structure this way.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #21154 (github issue number if applicable).

- [x] These changes do not require tests because it's refactoring code that should already be tested.

<!-- 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/21804)
<!-- Reviewable:end -->
2018-11-16 09:54:40 -05:00
Agustin Chiappe Berrini
14bc8ab754 Implement TaskSource for HistoryTraversal
And remove the method in window that returns it, because it isn't used
so far.
2018-11-13 14:18:51 -05:00
CYBAI
23a4d646ce Introduce rejectionhandled event 2018-11-13 22:29:45 +08: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
bors-servo
e580250d5d
Auto merge of #21988 - CYBAI:drop-promises, r=jdm
Clear refcounted promise before dropping JSRuntime

Not sure if this is the right solution?

I also tried to `impl Drop for LiveDOMReferences` but it's still executed after dropping JSRuntime.
So, maybe we should clear it before dropping the JSRuntime?

cc @jdm @asajeffrey

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #21331 .
- [x] There are tests for these changes; the status of `fetch/cross-origin-resource-policy/fetch-in-iframe.html` will be `OK`

<!-- 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/21988)
<!-- Reviewable:end -->
2018-10-29 08:31:12 -04:00
CYBAI
bca951d79e Drop TrustedPromise before dropping JSRuntime 2018-10-21 21:30:19 +08:00
CYBAI
f952d7ce0a Clear consumed rejections and add FIXME comments 2018-10-18 19:13:24 +08:00