Skip to content

armgit / moli

Public Imported from GitHub
0

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

981 B
Raw Blame
<!DOCTYPE html>
<html>
<head>
<title>registerTool() in detached frame</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.append(iframe);
  await load_promise;

  const iDOMException = iframe.contentWindow.DOMException;
  const iframe_modelContext = iframe.contentWindow.document.modelContext;
  iframe.remove();

  return promise_rejects_dom(t, 'InvalidStateError', iDOMException,
    iframe_modelContext.registerTool({
      name: 'detached_tool',
      description: 'Tool registered in detached frame',
      execute: async () => 'hello'
    }), 'Rejects InvalidStateError for detached frame');
}, 'registerTool() rejects `InvalidStateError` in detached frame');
</script>
</body>
</html>