Files
sousa-gecko/testing/web-platform/tests/webmcp/imperative/document-domain-enabled.https.html
T
François Beaufort fde9dc0f7f Bug 2051409 [wpt PR 60974] - [WebMCP] Make registerTool() return a promise, a=testonly
Automatic update from web-platform-tests
[WebMCP] Make registerTool() return a promise

Spec issue: https://github.com/webmachinelearning/webmcp/issues/175

Bug: 489045948
Change-Id: I254250d12ad78b95626939e0f7e22fd6fe56f70f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7916507
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: Fr <beaufort.francois@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1654308}

--

wpt-commits: 925e2819ce321d53de6069f93dcf1e37171381b9
wpt-pr: 60974
2026-07-10 09:21:26 +00:00

29 lines
1.0 KiB
HTML

<!DOCTYPE html>
<title>document.modelContext gated by document.domain being disabled</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(t => {
const tool = {
name: 'test_tool',
description: 'a test tool',
execute: () => 'success',
};
return promise_rejects_dom(t, 'SecurityError', document.modelContext.registerTool(tool));
}, 'modelContext.registerTool rejects with SecurityError when document.domain is enabled');
promise_test(t => {
return promise_rejects_dom(t, 'SecurityError', document.modelContext.getTools());
}, 'modelContext.getTools rejects with SecurityError when document.domain is enabled');
promise_test(t => {
const dummyTool = {
name: 'dummy',
description: 'dummy',
window: window,
origin: window.location.origin,
};
return promise_rejects_dom(t, 'SecurityError', document.modelContext.executeTool(dummyTool, ''));
}, 'modelContext.executeTool rejects with SecurityError when document.domain is enabled');
</script>