aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorSamson <16504129+sagudev@users.noreply.github.com>2024-07-29 09:20:15 +0200
committerGitHub <noreply@github.com>2024-07-29 07:20:15 +0000
commitd132a0273d17a140a916bb4c73cdb1d81fee1d2d (patch)
treeff8e2dd72e0d91d6891e7e4a4147d8f111091d08 /components/script/dom
parented8def28960fd64fa0d00bd67731d594c1042747 (diff)
downloadservo-d132a0273d17a140a916bb4c73cdb1d81fee1d2d.tar.gz
servo-d132a0273d17a140a916bb4c73cdb1d81fee1d2d.zip
Update mozjs (SpiderMonkey) to 128.0 (#32769)
* Update mozjs Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Fix changed readTransfer callback https://bugzilla.mozilla.org/show_bug.cgi?id=1842713 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Use NewExternalArrayBuffer from glue https://github.com/servo/mozjs/pull/474/commits/d33454be74ec5b8d8faf51fab3ed477b8913898b Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Fix columnorigin and filename being in latin1 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * fixup newexternalarray Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Float16 (this might require more work for codegen support) https://bugzilla.mozilla.org/show_bug.cgi?id=1833647 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * js.strict is removed https://bugzilla.mozilla.org/show_bug.cgi?id=1621603 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * asm options are now somewhere else https://hg.mozilla.org/mozilla-central/rev/26045c88e3972957087d535e7f259e08857bd2a2 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Comment out offthread compilation Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Set NDK to 26 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Fix 1-origin handling Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Expect `FinalizationRegistry` interface Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Good expectations Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * more expectations Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Add `WeakRef` to interfaces expectation Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * mozjs upgrade: fixes for Android Android NDK's layout has changed in r26 and 'lib64' no longer exists under `toolchain/llvm/prebuilt/linux-x86_64`. The libraries that used to be it are now present in `lib` folder itself. This patch updates the build configuration to use the `lib` folder instead when configuring the LIBCLANG_PATH environment variable. This patch also updates to a newer mozjs version that includes fixes for linker errors faced on Android (see #32769). Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * Patch libz-sys & update mozjs Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * update NDK version in README Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * Use servo/mozjs Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Update mozjs again Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/bindings/buffer_source.rs5
-rw-r--r--components/script/dom/bindings/error.rs4
-rw-r--r--components/script/dom/bindings/structuredclone.rs1
-rw-r--r--components/script/dom/htmlscriptelement.rs42
-rw-r--r--components/script/dom/webgl2renderingcontext.rs4
-rw-r--r--components/script/dom/webglrenderingcontext.rs1
6 files changed, 25 insertions, 32 deletions
diff --git a/components/script/dom/bindings/buffer_source.rs b/components/script/dom/bindings/buffer_source.rs
index 9287ec730fb..71c5051accd 100644
--- a/components/script/dom/bindings/buffer_source.rs
+++ b/components/script/dom/bindings/buffer_source.rs
@@ -10,9 +10,8 @@ use std::marker::PhantomData;
use std::ptr;
use std::sync::{Arc, Mutex};
-use js::jsapi::{
- Heap, JSObject, JS_GetArrayBufferViewBuffer, JS_IsArrayBufferViewObject, NewExternalArrayBuffer,
-};
+use js::jsapi::glue::NewExternalArrayBuffer;
+use js::jsapi::{Heap, JSObject, JS_GetArrayBufferViewBuffer, JS_IsArrayBufferViewObject};
use js::rust::wrappers::DetachArrayBuffer;
use js::rust::{CustomAutoRooterGuard, Handle, MutableHandleObject};
use js::typedarray::{CreateWith, TypedArray, TypedArrayElement, TypedArrayElementCreator};
diff --git a/components/script/dom/bindings/error.rs b/components/script/dom/bindings/error.rs
index f324bb3aad1..9aabb2c03d2 100644
--- a/components/script/dom/bindings/error.rs
+++ b/components/script/dom/bindings/error.rs
@@ -186,7 +186,7 @@ impl ErrorInfo {
}
let filename = {
- let filename = (*report)._base.filename as *const u8;
+ let filename = (*report)._base.filename.data_ as *const u8;
if !filename.is_null() {
let length = (0..).find(|idx| *filename.offset(*idx) == 0).unwrap();
let filename = from_raw_parts(filename, length as usize);
@@ -197,7 +197,7 @@ impl ErrorInfo {
};
let lineno = (*report)._base.lineno;
- let column = (*report)._base.column;
+ let column = (*report)._base.column._base;
let message = {
let message = (*report)._base.message_.data_ as *const u8;
diff --git a/components/script/dom/bindings/structuredclone.rs b/components/script/dom/bindings/structuredclone.rs
index a5a3e309371..d55104e519c 100644
--- a/components/script/dom/bindings/structuredclone.rs
+++ b/components/script/dom/bindings/structuredclone.rs
@@ -160,6 +160,7 @@ unsafe extern "C" fn write_callback(
unsafe extern "C" fn read_transfer_callback(
cx: *mut JSContext,
_r: *mut JSStructuredCloneReader,
+ _policy: *const CloneDataPolicy,
tag: u32,
_content: *mut raw::c_void,
extra_data: u64,
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs
index f18c827fcfa..ff5ca63c0eb 100644
--- a/components/script/dom/htmlscriptelement.rs
+++ b/components/script/dom/htmlscriptelement.rs
@@ -1,7 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
-
+#![allow(unused_imports)]
use core::ffi::c_void;
use std::cell::Cell;
use std::fs::{create_dir_all, read_to_string, File};
@@ -19,12 +19,8 @@ use encoding_rs::Encoding;
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
-use js::jsapi::{CanCompileOffThread, CompileToStencilOffThread1, OffThreadToken};
use js::jsval::UndefinedValue;
-use js::rust::{
- transform_str_to_source_text, CompileOptionsWrapper, FinishOffThreadStencil, HandleObject,
- Stencil,
-};
+use js::rust::{transform_str_to_source_text, CompileOptionsWrapper, HandleObject, Stencil};
use net_traits::request::{
CorsSettings, CredentialsMode, Destination, ParserMetadata, RequestBuilder,
};
@@ -74,7 +70,8 @@ use crate::task::TaskCanceller;
use crate::task_source::dom_manipulation::DOMManipulationTaskSource;
use crate::task_source::{TaskSource, TaskSourceName};
-pub struct OffThreadCompilationContext {
+// TODO Implement offthread compilation in mozjs
+/*pub struct OffThreadCompilationContext {
script_element: Trusted<HTMLScriptElement>,
script_kind: ExternalScriptKind,
final_url: ServoUrl,
@@ -85,14 +82,6 @@ pub struct OffThreadCompilationContext {
fetch_options: ScriptFetchOptions,
}
-/// A wrapper to mark OffThreadToken as Send,
-/// which should be safe according to
-/// mozjs/js/public/OffThreadScriptCompilation.h
-struct OffThreadCompilationToken(*mut OffThreadToken);
-
-#[allow(unsafe_code)]
-unsafe impl Send for OffThreadCompilationToken {}
-
#[allow(unsafe_code)]
unsafe extern "C" fn off_thread_compilation_callback(
token: *mut OffThreadToken,
@@ -146,7 +135,7 @@ unsafe extern "C" fn off_thread_compilation_callback(
}),
&context.canceller,
);
-}
+}*/
/// An unique id for script element.
#[derive(Clone, Copy, Debug, Eq, Hash, JSTraceable, PartialEq)]
@@ -428,9 +417,10 @@ impl FetchResponseListener for ClassicContext {
let elem = self.elem.root();
let global = elem.global();
- let cx = GlobalScope::get_cx();
+ //let cx = GlobalScope::get_cx();
let _ar = enter_realm(&*global);
+ /*
let options = unsafe { CompileOptionsWrapper::new(*cx, final_url.as_str(), 1) };
let can_compile_off_thread = pref!(dom.script.asynch) &&
@@ -460,15 +450,15 @@ impl FetchResponseListener for ClassicContext {
)
.is_null());
}
- } else {
- let load = ScriptOrigin::external(
- Rc::new(DOMString::from(source_text)),
- final_url.clone(),
- self.fetch_options.clone(),
- ScriptType::Classic,
- );
- finish_fetching_a_classic_script(&elem, self.kind, self.url.clone(), Ok(load));
- }
+ } else {*/
+ let load = ScriptOrigin::external(
+ Rc::new(DOMString::from(source_text)),
+ final_url.clone(),
+ self.fetch_options.clone(),
+ ScriptType::Classic,
+ );
+ finish_fetching_a_classic_script(&elem, self.kind, self.url.clone(), Ok(load));
+ //}
}
fn resource_timing_mut(&mut self) -> &mut ResourceFetchTiming {
diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs
index 3f1a7e98d72..d2b3cfe8ea3 100644
--- a/components/script/dom/webgl2renderingcontext.rs
+++ b/components/script/dom/webgl2renderingcontext.rs
@@ -110,10 +110,12 @@ pub struct WebGL2RenderingContext {
default_fb_drawbuffer: Cell<u32>,
}
+// TODO: This should be in mozjs
+// upstream: https://searchfox.org/mozilla-central/source/js/public/ScalarType.h#66
fn typedarray_elem_size(typeid: Type) -> usize {
match typeid {
Type::Int8 | Type::Uint8 | Type::Uint8Clamped => 1,
- Type::Int16 | Type::Uint16 => 2,
+ Type::Int16 | Type::Uint16 | Type::Float16 => 2,
Type::Int32 | Type::Uint32 | Type::Float32 => 4,
Type::Int64 | Type::Float64 => 8,
Type::BigInt64 | Type::BigUint64 => 8,
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 42482e7abd0..c9c0607518f 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -4965,6 +4965,7 @@ fn array_buffer_type_to_sized_type(type_: Type) -> Option<SizedDataType> {
Type::Int16 => Some(SizedDataType::Int16),
Type::Int32 => Some(SizedDataType::Int32),
Type::Float32 => Some(SizedDataType::Float32),
+ Type::Float16 |
Type::Float64 |
Type::BigInt64 |
Type::BigUint64 |