Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

847 B
Raw Blame
<!DOCTYPE html>
<html>
<head>
<title>same-origin registerTool() regression test</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
promise_test(async t => {
  const iframe = document.createElement('iframe');
  iframe.src = '/common/blank.html';

  const load_promise = new Promise(resolve => iframe.onload = resolve);
  document.body.appendChild(iframe);
  await load_promise;

  const iframe_document = iframe.contentWindow.document;

  // Should not reject!
  await iframe_document.modelContext.registerTool({
    name: 'connected_tool',
    description: 'Tool registered in connected frame',
    execute: async () => 'hello'
  });
}, 'registerTool() does not reject in connected same-origin iframe navigated away of about:blank');
</script>
</body>
</html>