diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e527a330601..e1b3296c4e0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,6 +12,7 @@ files: | media/base/starboard/| media/starboard/| starboard/| + third_party/blink/renderer/modules/cobalt/| components/viz/service/display/starboard/| ui/ozone/platform/starboard/| .pre-commit-config.yaml| diff --git a/third_party/blink/renderer/bindings/generated_in_modules.gni b/third_party/blink/renderer/bindings/generated_in_modules.gni index 7394d035208..2104bfb492e 100644 --- a/third_party/blink/renderer/bindings/generated_in_modules.gni +++ b/third_party/blink/renderer/bindings/generated_in_modules.gni @@ -2797,6 +2797,8 @@ if (is_cobalt) { "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_crash_annotator.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_h_5_vcc.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_h_5_vcc.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_h_5_vcc_system.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_h_5_vcc_system.h", ] } diff --git a/third_party/blink/renderer/bindings/idl_in_modules.gni b/third_party/blink/renderer/bindings/idl_in_modules.gni index a9653c43645..32d5c937c96 100644 --- a/third_party/blink/renderer/bindings/idl_in_modules.gni +++ b/third_party/blink/renderer/bindings/idl_in_modules.gni @@ -1212,6 +1212,7 @@ if (is_cobalt) { "//third_party/blink/renderer/modules/cobalt/crash_annotator/crash_annotator.idl", "//third_party/blink/renderer/modules/cobalt/h_5_vcc.idl", "//third_party/blink/renderer/modules/cobalt/window_h_5_vcc.idl", + "//third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.idl", ], "abspath") } diff --git a/third_party/blink/renderer/modules/BUILD.gn b/third_party/blink/renderer/modules/BUILD.gn index b1989956316..d8bd3ee36bb 100644 --- a/third_party/blink/renderer/modules/BUILD.gn +++ b/third_party/blink/renderer/modules/BUILD.gn @@ -171,6 +171,7 @@ component("modules") { sub_modules += [ "//third_party/blink/renderer/modules/cobalt:h_5_vcc", "//third_party/blink/renderer/modules/cobalt/crash_annotator", + "//third_party/blink/renderer/modules/cobalt/h5vcc_system", ] } diff --git a/third_party/blink/renderer/modules/cobalt/BUILD.gn b/third_party/blink/renderer/modules/cobalt/BUILD.gn index 7441313f2f2..2972145f424 100644 --- a/third_party/blink/renderer/modules/cobalt/BUILD.gn +++ b/third_party/blink/renderer/modules/cobalt/BUILD.gn @@ -19,5 +19,8 @@ blink_modules_sources("h_5_vcc") { "h_5_vcc.cc", "h_5_vcc.h", ] - deps = ["//third_party/blink/renderer/modules/cobalt/crash_annotator"] + deps = [ + "//third_party/blink/renderer/modules/cobalt/crash_annotator", + "//third_party/blink/renderer/modules/cobalt/h5vcc_system", + ] } diff --git a/third_party/blink/renderer/modules/cobalt/crash_annotator/crash_annotator.cc b/third_party/blink/renderer/modules/cobalt/crash_annotator/crash_annotator.cc index 850e812c766..63adc6466dd 100644 --- a/third_party/blink/renderer/modules/cobalt/crash_annotator/crash_annotator.cc +++ b/third_party/blink/renderer/modules/cobalt/crash_annotator/crash_annotator.cc @@ -42,11 +42,9 @@ ScriptPromise CrashAnnotator::setString(ScriptState* script_state, EnsureReceiverIsBound(); remote_crash_annotator_->SetString( - key, - value, - WTF::BindOnce( - &CrashAnnotator::OnSetString, - WrapPersistent(this), WrapPersistent(resolver))); + key, value, + WTF::BindOnce(&CrashAnnotator::OnSetString, WrapPersistent(this), + WrapPersistent(resolver))); return resolver->Promise(); } diff --git a/third_party/blink/renderer/modules/cobalt/h5vcc_system/BUILD.gn b/third_party/blink/renderer/modules/cobalt/h5vcc_system/BUILD.gn new file mode 100644 index 00000000000..53defb79277 --- /dev/null +++ b/third_party/blink/renderer/modules/cobalt/h5vcc_system/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright 2025 The Cobalt Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//third_party/blink/renderer/modules/modules.gni") + +blink_modules_sources("h5vcc_system") { + sources = [ + "h_5_vcc_system.cc", + "h_5_vcc_system.h", + ] +} diff --git a/third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.cc b/third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.cc new file mode 100644 index 00000000000..a114ef0f1a6 --- /dev/null +++ b/third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.cc @@ -0,0 +1,36 @@ +// Copyright 2025 The Cobalt Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.h" + +#include "third_party/blink/renderer/core/frame/local_dom_window.h" + +namespace blink { + +H5vccSystem::H5vccSystem(LocalDOMWindow& window) {} + +const String H5vccSystem::advertisingId() const { + NOTIMPLEMENTED(); + + // TODO(b/377049113) add a mojom service and populate the value for + // advertising_id_. + // return advertising_id_; + return String("fake advertisingId"); +} + +void H5vccSystem::Trace(Visitor* visitor) const { + ScriptWrappable::Trace(visitor); +} + +} // namespace blink diff --git a/third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.h b/third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.h new file mode 100644 index 00000000000..0284c30e847 --- /dev/null +++ b/third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.h @@ -0,0 +1,41 @@ +// Copyright 2025 The Cobalt Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_H5VCC_SYSTEM_H_5_VCC_SYSTEM_H_ +#define THIRD_PARTY_BLINK_RENDERER_MODULES_H5VCC_SYSTEM_H_5_VCC_SYSTEM_H_ + +#include "third_party/blink/renderer/modules/modules_export.h" +#include "third_party/blink/renderer/platform/bindings/script_wrappable.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" + +namespace blink { + +class LocalDOMWindow; +class ScriptState; + +class MODULES_EXPORT H5vccSystem final : public ScriptWrappable { + DEFINE_WRAPPERTYPEINFO(); + + public: + explicit H5vccSystem(LocalDOMWindow&); + + // Web-exposed interface: + const String advertisingId() const; + + void Trace(Visitor*) const override; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_H5VCC_SYSTEM_H_5_VCC_SYSTEM_H_ diff --git a/third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.idl b/third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.idl new file mode 100644 index 00000000000..696095c75c5 --- /dev/null +++ b/third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.idl @@ -0,0 +1,23 @@ +// Copyright 2025 The Cobalt Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This interface mirrors the H5vccSystem Web IDL defined in Cobalt LTS 25: +// https://github.com/youtube/cobalt/blob/25.lts.stable/cobalt/h5vcc/h5vcc_system.idl +[ + Exposed=Window, + SecureContext +] +interface H5vccSystem { + readonly attribute DOMString advertisingId; +}; diff --git a/third_party/blink/renderer/modules/cobalt/h_5_vcc.cc b/third_party/blink/renderer/modules/cobalt/h_5_vcc.cc index bd21a25dfcd..82c5720867b 100644 --- a/third_party/blink/renderer/modules/cobalt/h_5_vcc.cc +++ b/third_party/blink/renderer/modules/cobalt/h_5_vcc.cc @@ -16,13 +16,14 @@ #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/modules/cobalt/crash_annotator/crash_annotator.h" +#include "third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.h" namespace blink { // static const char H5vcc::kSupplementName[] = "H5vcc"; -//static +// static H5vcc* H5vcc::h5vcc(LocalDOMWindow& window) { H5vcc* h5vcc = Supplement::From(window); if (!h5vcc && window.GetExecutionContext()) { @@ -34,10 +35,12 @@ H5vcc* H5vcc::h5vcc(LocalDOMWindow& window) { H5vcc::H5vcc(LocalDOMWindow& window) : Supplement(window), - crash_annotator_(MakeGarbageCollected(window)) {} + crash_annotator_(MakeGarbageCollected(window)), + system_(MakeGarbageCollected(window)) {} void H5vcc::Trace(Visitor* visitor) const { visitor->Trace(crash_annotator_); + visitor->Trace(system_); Supplement::Trace(visitor); ScriptWrappable::Trace(visitor); } diff --git a/third_party/blink/renderer/modules/cobalt/h_5_vcc.h b/third_party/blink/renderer/modules/cobalt/h_5_vcc.h index 6bebc73af1e..0974da14adb 100644 --- a/third_party/blink/renderer/modules/cobalt/h_5_vcc.h +++ b/third_party/blink/renderer/modules/cobalt/h_5_vcc.h @@ -27,10 +27,10 @@ namespace blink { class ScriptState; class CrashAnnotator; class LocalDOMWindow; +class H5vccSystem; -class MODULES_EXPORT H5vcc final - : public ScriptWrappable, - public Supplement { +class MODULES_EXPORT H5vcc final : public ScriptWrappable, + public Supplement { DEFINE_WRAPPERTYPEINFO(); public: @@ -43,12 +43,15 @@ class MODULES_EXPORT H5vcc final CrashAnnotator* crashAnnotator() { return crash_annotator_; } + H5vccSystem* system() { return system_; } + void Trace(Visitor*) const override; private: Member crash_annotator_; + Member system_; }; -} +} // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_MODULES_COBALT_H_5_VCC_H_ diff --git a/third_party/blink/renderer/modules/cobalt/h_5_vcc.idl b/third_party/blink/renderer/modules/cobalt/h_5_vcc.idl index fa8677effd1..731f76a8c71 100644 --- a/third_party/blink/renderer/modules/cobalt/h_5_vcc.idl +++ b/third_party/blink/renderer/modules/cobalt/h_5_vcc.idl @@ -12,10 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +// This interface mirrors the H5vcc Web IDL defined in Cobalt LTS 25: +// https://github.com/youtube/cobalt/blob/25.lts.stable/cobalt/h5vcc/h5vcc.idl [ Exposed=Window, SecureContext ] interface H5vcc { readonly attribute CrashAnnotator crashAnnotator; + readonly attribute H5vccSystem system; }; diff --git a/third_party/blink/web_tests/external/wpt/cobalt/h5vcc-system/h5vcc-system.https.sub.html b/third_party/blink/web_tests/external/wpt/cobalt/h5vcc-system/h5vcc-system.https.sub.html new file mode 100644 index 00000000000..1ff84f72cbd --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/cobalt/h5vcc-system/h5vcc-system.https.sub.html @@ -0,0 +1,15 @@ + + + + Test H5vccSystem web API. + + + + + + + \ No newline at end of file