Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / js / xpconnect / tests / unit / head.js
blobbe3d74401a1acb8ee0af6ab501ace1013f416abb
1 "use strict";
3 // Wraps the given object in an XPConnect wrapper and, if an interface
4 // is passed, queries the result to that interface.
5 function xpcWrap(obj, iface) {
6   let ifacePointer = Cc[
7     "@mozilla.org/supports-interface-pointer;1"
8   ].createInstance(Ci.nsISupportsInterfacePointer);
10   ifacePointer.data = obj;
11   if (iface) {
12     return ifacePointer.data.QueryInterface(iface);
13   }
14   return ifacePointer.data;
17 function createContentWindow(uri) {
18   const principal = Services.scriptSecurityManager
19     .createContentPrincipalFromOrigin(uri);
20   const webnav = Services.appShell.createWindowlessBrowser(false);
21   const docShell = webnav.docShell;
22   docShell.createAboutBlankDocumentViewer(principal, principal);
23   return webnav.document.defaultView;
26 function createChromeWindow() {
27   const principal = Services.scriptSecurityManager.getSystemPrincipal();
28   const webnav = Services.appShell.createWindowlessBrowser(true);
29   const docShell = webnav.docShell;
30   docShell.createAboutBlankDocumentViewer(principal, principal);
31   return webnav.document.defaultView;