Skip to content

armgit / moli

Public Imported from GitHub
0

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

1.5 KB
Raw Blame
<!doctype html>
<meta charset="utf-8">
<script src="/wpt/resources/testharness.js"></script>
<script src="/wpt/resources/testharnessreport.js"></script>
<script src="/wpt/resources/moli-wpt-adapter.js"></script>
<script src="/wpt/resources/WebIDLParser.js"></script>
<script src="/wpt/resources/idlharness.js"></script>
<script>
idl_test([`
interface MessageChannel {
  constructor();
  readonly attribute MessagePort port1;
  readonly attribute MessagePort port2;
};

interface MessagePort : EventTarget {
  undefined postMessage(any message, optional object options = {});
  undefined start();
  undefined close();
};
`], [], function (idlArray) {
  idlArray.enable_function_length_assertions();
  idlArray.enable_interface_descriptor_assertions();
  idlArray.enable_operation_descriptor_assertions();
  idlArray.enable_attribute_descriptor_assertions();
  idlArray.enable_object_brand_assertions();
  idlArray.add_objects({
    MessageChannel: ["new MessageChannel()"],
    MessagePort: ["new MessageChannel().port1"]
  });
});

test(function () {
  const channel = new MessageChannel();
  assert_false(Object.prototype.hasOwnProperty.call(channel, "port1"));
  assert_false(Object.prototype.hasOwnProperty.call(channel, "port2"));
  assert_true(channel.port1 instanceof MessagePort);
  assert_true(channel.port2 instanceof MessagePort);
  assert_equals(channel.port1, channel.port1);
  assert_equals(channel.port2, channel.port2);
}, "MessageChannel exposes inherited stable same-object ports");
</script>