diff --git a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp index e600860285..1b84757f05 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp +++ b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp @@ -49,7 +49,7 @@ void WorkerGlobalScope::visit_edges(Cell::Visitor& visitor) } // https://html.spec.whatwg.org/multipage/workers.html#importing-scripts-and-libraries -WebIDL::ExceptionOr WorkerGlobalScope::import_scripts(Vector urls) +WebIDL::ExceptionOr WorkerGlobalScope::import_scripts(Vector urls) { // The algorithm may optionally be customized by supplying custom perform the fetch hooks, // which if provided will be used when invoking fetch a classic worker-imported script. @@ -104,7 +104,7 @@ ENUMERATE_WORKER_GLOBAL_SCOPE_EVENT_HANDLERS(__ENUMERATE) #undef __ENUMERATE // https://html.spec.whatwg.org/multipage/webappapis.html#dom-origin -DeprecatedString WorkerGlobalScope::origin() const +String WorkerGlobalScope::origin() const { // FIXME: The origin getter steps are to return this's relevant settings object's origin, serialized. return {}; @@ -127,14 +127,14 @@ bool WorkerGlobalScope::cross_origin_isolated() const } // https://html.spec.whatwg.org/multipage/webappapis.html#dom-btoa -WebIDL::ExceptionOr WorkerGlobalScope::btoa(DeprecatedString const& data) const +WebIDL::ExceptionOr WorkerGlobalScope::btoa(String const& data) const { // FIXME: This is the same as the implementation in Bindings/WindowObject.cpp // Find a way to share this implementation, since they come from the same mixin. // The btoa(data) method must throw an "InvalidCharacterError" DOMException if data contains any character whose code point is greater than U+00FF. Vector byte_string; - byte_string.ensure_capacity(data.length()); + byte_string.ensure_capacity(data.bytes().size()); for (u32 code_point : Utf8View(data)) { if (code_point > 0xff) return WebIDL::InvalidCharacterError::create(realm(), "Data contains characters outside the range U+0000 and U+00FF"); @@ -143,17 +143,17 @@ WebIDL::ExceptionOr WorkerGlobalScope::btoa(DeprecatedString c // Otherwise, the user agent must convert data to a byte sequence whose nth byte is the eight-bit representation of the nth code point of data, // and then must apply forgiving-base64 encode to that byte sequence and return the result. - return TRY_OR_THROW_OOM(vm(), encode_base64(byte_string.span())).to_deprecated_string(); + return TRY_OR_THROW_OOM(vm(), encode_base64(byte_string.span())); } // https://html.spec.whatwg.org/multipage/webappapis.html#dom-atob -WebIDL::ExceptionOr WorkerGlobalScope::atob(DeprecatedString const& data) const +WebIDL::ExceptionOr WorkerGlobalScope::atob(String const& data) const { // FIXME: This is the same as the implementation in Bindings/WindowObject.cpp // Find a way to share this implementation, since they come from the same mixin. // 1. Let decodedData be the result of running forgiving-base64 decode on data. - auto decoded_data = decode_base64(data.view()); + auto decoded_data = decode_base64(data.bytes_as_string_view()); // 2. If decodedData is failure, then throw an "InvalidCharacterError" DOMException. if (decoded_data.is_error()) diff --git a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h index c6bf3d6c1e..3beb9828aa 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h +++ b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h @@ -42,7 +42,7 @@ public: JS::NonnullGCPtr location() const; JS::NonnullGCPtr navigator() const; - WebIDL::ExceptionOr import_scripts(Vector urls); + WebIDL::ExceptionOr import_scripts(Vector urls); #undef __ENUMERATE #define __ENUMERATE(attribute_name, event_name) \ @@ -54,11 +54,11 @@ public: // Following methods are from the WindowOrWorkerGlobalScope mixin // https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope-mixin - DeprecatedString origin() const; + String origin() const; bool is_secure_context() const; bool cross_origin_isolated() const; - WebIDL::ExceptionOr btoa(DeprecatedString const& data) const; - WebIDL::ExceptionOr atob(DeprecatedString const& data) const; + WebIDL::ExceptionOr btoa(String const& data) const; + WebIDL::ExceptionOr atob(String const& data) const; // Non-IDL public methods diff --git a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.idl b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.idl index a595badd04..94ea0f9dd7 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.idl +++ b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.idl @@ -5,7 +5,7 @@ #import // https://html.spec.whatwg.org/multipage/workers.html#workerglobalscope -[Exposed=Worker] +[Exposed=Worker, UseNewAKString] interface WorkerGlobalScope : EventTarget { readonly attribute WorkerGlobalScope self; readonly attribute WorkerLocation location;