Пример #1
0
        public void GetJsLoader_CleanXpComInstance_ReturnsValidInstance()
        {
            var instance = Xpcom.GetService <xpcIJSModuleLoader>("@mozilla.org/moz/jsloader;1");

            Assert.IsNotNull(instance);
            Marshal.ReleaseComObject(instance);
        }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            lblfm12fm2.Visible = false;
            lbl12lbl3.Visible  = false;
            //if (MessageBox.Show("Do you want to delete cookies?", "About to delete all cookies", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            //{
            nsICookieManager CookieMan;

            CookieMan = Xpcom.GetService <nsICookieManager>("@mozilla.org/cookiemanager;1");
            CookieMan = Xpcom.QueryInterface <nsICookieManager>(CookieMan);
            CookieMan.RemoveAll();

            geckoWebBrowser1.Navigate("http://www.quikr.com/SignIn");

            while (geckoWebBrowser1.IsBusy)
            {
                Application.DoEvents();
            }

            string redir1 = "http://www.quikr.com/SignIn?aj=1&for=login_popup&GreetingName=";
            //string redirmid = Uri.EscapeDataString(lblfm12fm2.Text);
            string redirmid = Uri.EscapeDataString("*****@*****.**");
            string redir2   = "&Password="******"wRt*2014");
            string result    = String.Concat(redir1 + redirmid + redir2 + redirmid2);

            geckoWebBrowser1.Navigate(result);
            //}
        }
Пример #3
0
        public void GetControllers_CleanXpComInstance_ReturnsValidInstance()
        {
            var instance = Xpcom.GetService <nsIControllers>("@mozilla.org/xul/xul-controllers;1");

            Assert.IsNotNull(instance);
            Marshal.ReleaseComObject(instance);
        }
Пример #4
0
        public void GetXPConnect_CleanXpComInstance_ReturnsValidInstance()
        {
            var instance = Xpcom.GetService <nsIXPConnect>("@mozilla.org/js/xpc/XPConnect;1");

            Assert.IsNotNull(instance);
            Marshal.ReleaseComObject(instance);
        }
Пример #5
0
        public void GetHandlerService_CleanXpComInstance_ReturnsValidInstance()
        {
            var instance = Xpcom.GetService <nsIHandlerService>("@mozilla.org/uriloader/handler-service;1");

            Assert.IsNotNull(instance);
            Marshal.ReleaseComObject(instance);
        }
Пример #6
0
        public void GetProtocolProxyService_CleanXpComInstance_ReturnsValidInstance()
        {
            var instance = Xpcom.GetService <nsIProtocolProxyService2>("@mozilla.org/network/protocol-proxy-service;1");

            Assert.IsNotNull(instance);
            Marshal.ReleaseComObject(instance);
        }
Пример #7
0
        public void GetConsoleService_CleanXpComInstance_ReturnsValidInstance()
        {
            var instance = Xpcom.GetService <nsIConsoleService>("@mozilla.org/consoleservice;1");

            Assert.IsNotNull(instance);
            Marshal.ReleaseComObject(instance);
        }
Пример #8
0
        public void GetAppShell_CleanXpComInstance_ReturnsValidInstance()
        {
            System.IntPtr ptr      = (IntPtr)Xpcom.GetService(new Guid("2d96b3df-c051-11d1-a827-0040959a28c9"));
            var           instance = (nsIAppShell)Xpcom.GetObjectForIUnknown(ptr);

            Assert.IsNotNull(instance);
        }
Пример #9
0
        private void StartMakingPdf()
        {
            _print = Xpcom.QueryInterface <nsIWebBrowserPrint>(_browser.Window.DomWindow);

            var service       = Xpcom.GetService <nsIPrintSettingsService>("@mozilla.org/gfx/printsettings-service;1");
            var printSettings = service.GetNewPrintSettingsAttribute();

            printSettings.SetToFileNameAttribute(_pathToTempPdf);
            printSettings.SetPrintToFileAttribute(true);
            printSettings.SetPrintSilentAttribute(true);             //don't show a printer settings dialog
            printSettings.SetShowPrintProgressAttribute(false);

            if (_conversionOrder.PageHeightInMillimeters > 0)
            {
                printSettings.SetPaperHeightAttribute(_conversionOrder.PageHeightInMillimeters);
                printSettings.SetPaperWidthAttribute(_conversionOrder.PageWidthInMillimeters);
                printSettings.SetPaperSizeUnitAttribute(1);                 //0=in, >0 = mm
            }
            else
            {
                //doesn't actually work.  Probably a problem in the geckofx wrapper. Meanwhile we just look it up from our small list
                //printSettings.SetPaperNameAttribute(_conversionOrder.PageSizeName);

                var          size = GetPaperSize(_conversionOrder.PageSizeName);
                const double inchesPerMillimeter = 0.0393701;
                printSettings.SetPaperHeightAttribute(size.HeightInMillimeters * inchesPerMillimeter);
                printSettings.SetPaperWidthAttribute(size.WidthInMillimeters * inchesPerMillimeter);
            }
            //this seems to be in inches, and doesn't have a unit-setter (unlike the paper size ones)
            const double kMillimetersPerInch = 25;             //TODO what is it, exactly?

            printSettings.SetMarginTopAttribute(_conversionOrder.TopMarginInMillimeters / kMillimetersPerInch);
            printSettings.SetMarginBottomAttribute(_conversionOrder.BottomMarginInMillimeters / kMillimetersPerInch);
            printSettings.SetMarginLeftAttribute(_conversionOrder.LeftMarginInMillimeters / kMillimetersPerInch);
            printSettings.SetMarginRightAttribute(_conversionOrder.RightMarginInMillimeters / kMillimetersPerInch);


            printSettings.SetDownloadFontsAttribute(true);             //review: what's this for?
            printSettings.SetOrientationAttribute(_conversionOrder.Landscape ? 1 : 0);
            printSettings.SetHeaderStrCenterAttribute("");
            printSettings.SetHeaderStrLeftAttribute("");
            printSettings.SetHeaderStrRightAttribute("");
            printSettings.SetFooterStrRightAttribute("");
            printSettings.SetFooterStrLeftAttribute("");
            printSettings.SetFooterStrCenterAttribute("");

            printSettings.SetPrintBGColorsAttribute(true);
            printSettings.SetPrintBGImagesAttribute(true);


            //TODO: doesn't seem to do anything. Probably a problem in the geckofx wrapper
            //printSettings.SetScalingAttribute(_conversionOrder.Zoom);

            printSettings.SetOutputFormatAttribute(2);             // 2 == kOutputFormatPDF

            Status = "Making PDF..";

            _print.Print(printSettings, this);
            _checkForPdfFinishedTimer.Enabled = true;
        }
Пример #10
0
        public void GetJsSubscriptLoader_CleanXpComInstance_ReturnsValidInstance()
        {
            var instance = Xpcom.GetService <mozIJSSubScriptLoader>("@mozilla.org/moz/jssubscript-loader;1");

            Assert.IsNotNull(instance);
            Marshal.ReleaseComObject(instance);
        }
Пример #11
0
        public void GetThreadPool_CleanXpComInstance_ReturnsValidInstance()
        {
            var instance = Xpcom.GetService <nsIThreadPool>("@mozilla.org/thread-pool;1");

            Assert.IsNotNull(instance);
            Marshal.ReleaseComObject(instance);
        }
Пример #12
0
        public void GetInterfaceInfoManager_CleanXpComInstance_ReturnsValidInstance()
        {
            var instance = Xpcom.GetService <nsIInterfaceInfoManager>("@mozilla.org/xpti/interfaceinfomanager-service;1");

            Assert.IsNotNull(instance);
            Marshal.ReleaseComObject(instance);
        }
Пример #13
0
        /// <summary>
        /// PDF保存開始処理
        /// </summary>
        private void StartMakingPdf()
        {
            nsIWebBrowserPrint      print       = Xpcom.QueryInterface <nsIWebBrowserPrint>(gecko.Window.DomWindow);
            nsIPrintSettingsService prtService  = Xpcom.GetService <nsIPrintSettingsService>("@mozilla.org/gfx/printsettings-service;1");
            nsIPrintSettings        prtSettings = prtService.GetNewPrintSettingsAttribute();

            prtSettings.SetToFileNameAttribute(tempPdf);        // 保存PDFファイル名
            prtSettings.SetPrintSilentAttribute(true);          // サイレントモード
            prtSettings.SetShowPrintProgressAttribute(false);   // 印刷進捗非表示

            prtSettings.SetPaperHeightAttribute(297.0 * ipm);   // 高さ設定 A4
            prtSettings.SetPaperWidthAttribute(210.0 * ipm);    // 幅設定  A4

            prtSettings.SetMarginTopAttribute(5.08 / mpi);      // 上余白設定
            prtSettings.SetMarginBottomAttribute(5.18 / mpi);   // 下余白
            prtSettings.SetMarginLeftAttribute(5.08 / mpi);     // 左余白
            prtSettings.SetMarginRightAttribute(5.1 / mpi);     // 右余白

            prtSettings.SetHeaderStrLeftAttribute("");          // ヘッダー 左
            prtSettings.SetHeaderStrCenterAttribute("");        // ヘッダー 中
            prtSettings.SetHeaderStrRightAttribute("");         // ヘッダー 右
            prtSettings.SetFooterStrLeftAttribute("");          // フッター 左
            prtSettings.SetFooterStrCenterAttribute("");        // フッター 中
            prtSettings.SetFooterStrRightAttribute("");         // フッター 右
            prtSettings.SetDownloadFontsAttribute(false);

            prtSettings.SetPrintBGColorsAttribute(true);
            prtSettings.SetPrintBGImagesAttribute(true);

            prtSettings.SetOrientationAttribute(nsIPrintSettingsConsts.kPortraitOrientation);   // 用紙向き
            prtSettings.SetOutputFormatAttribute(nsIPrintSettingsConsts.kOutputFormatPDF);      // 保存フォーマット PDF

            print.Print(prtSettings, this);
            finishedTimer.Enabled = true;
        }
Пример #14
0
        private void timer_cleardata_Tick(object sender, EventArgs e) // clear cache cookies history etc
        {
            nsIBrowserHistory historyMan = Xpcom.GetService <nsIBrowserHistory>(Gecko.Contracts.NavHistoryService);

            historyMan = Xpcom.QueryInterface <nsIBrowserHistory>(historyMan);
            historyMan.RemoveAllPages();


            nsICookieManager CookieMan;

            CookieMan = Xpcom.GetService <nsICookieManager>("@mozilla.org/cookiemanager;1");
            CookieMan = Xpcom.QueryInterface <nsICookieManager>(CookieMan);
            CookieMan.RemoveAll();

            // https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/imgICache
            Gecko.Cache.ImageCache.ClearCache(true);
            Gecko.Cache.ImageCache.ClearCache(false);
//            Gecko.Cache.CacheService.Clear(new CacheStoragePolicy());

            nsICacheStorageService cache;

            cache = Xpcom.GetService <nsICacheStorageService>("@mozilla.org/netwerk/cache-storage-service;1");
            try { cache.Clear(); }
            catch (Exception ex) { throw new ApplicationException("Could not clear cache:", ex); }

            imgICache icache;

            icache = Xpcom.GetService <imgITools>("@mozilla.org/image/tools;1").GetImgCacheForDocument(null);
            try { icache.ClearCache(false); }
            catch (Exception ex) { throw new ApplicationException("Could not clear image cache:", ex); }

            timer_cleardata.Stop();
        }
Пример #15
0
        private void BrowserLoad(object sender, EventArgs e)
        {
            Xpcom.Initialize("Firefox");

            nsICookieManager CookieMan;

            CookieMan = Xpcom.GetService <nsICookieManager>("@mozilla.org/cookiemanager;1");
            CookieMan = Xpcom.QueryInterface <nsICookieManager>(CookieMan);
            CookieMan.RemoveAll();

            GeckoPreferences.User["browser.xul.error_pages.enabled"] = false;
            GeckoPreferences.User["browser.download.manager.showAlertOnComplete"] = false;
            GeckoPreferences.User["security.warn_viewing_mixed"]       = false;
            GeckoPreferences.User["privacy.popups.showBrowserMessage"] = false;
            GeckoPreferences.User["browser.xul.error_pages.enabled"]   = true;

            browserPanel.Visible = false;

            browser = new GeckoWebBrowser()
            {
                Dock = DockStyle.Fill
            };
            browser.NoDefaultContextMenu = true;
            browser.Navigated           += BrowserNavigated;

            Controls.Add(browser);

            browser.Navigate(Url);
        }
Пример #16
0
        public void GetMessageLoop_CleanXpComInstance_ReturnsValidInstance()
        {
            var instance = Xpcom.GetService <nsISupports>("@mozilla.org/message-loop;1");

            Assert.IsNotNull(instance);
            Marshal.ReleaseComObject(instance);
        }
Пример #17
0
        bool t = true; //bi test için kullanmıştım, isterseniz kaldırabilirsiniz.

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (basla < prxy_lstesi.Count)
            {
                Xpcom.QueryInterface <nsICookieManager>(Xpcom.GetService <nsICookieManager>("@mozilla.org/cookiemanager;1")).RemoveAll();
                CookieManager.RemoveAll();
                ((Form1)(Application.OpenForms["Form1"])).listBox3.Items.Add(url + " için timer1 çalışıyor.");
                ayrac = prxy_lstesi[basla].Split(':');
                GeckoPreferences.User["general.useragent.override"] = user_Agent_listesi[new Random().Next(0, user_Agent_listesi.Count - 1)];

                if (t == true) // test için eklemiştim, isterseniz kaldırabilirsiniz bu kontrolü.
                {
                    switch (tur)
                    {
                    case "4":
                        GeckoPreferences.Default["network.proxy.socks"]      = ayrac[0];
                        GeckoPreferences.Default["network.proxy.socks_port"] = Convert.ToInt32(ayrac[1]);
                        GeckoPreferences.User["network.proxy.socks_version"] = 4;
                        baglanti_turu = "SOCKS4";
                        break;

                    case "5":
                        GeckoPreferences.Default["network.proxy.socks"]      = ayrac[0];
                        GeckoPreferences.Default["network.proxy.socks_port"] = Convert.ToInt32(ayrac[1]);
                        GeckoPreferences.User["network.proxy.socks_version"] = 5;
                        baglanti_turu = "SOCKS5";
                        break;

                    case "h":
                        GeckoPreferences.Default["network.proxy.type"]      = 1;
                        GeckoPreferences.Default["network.proxy.http"]      = ayrac[0];
                        GeckoPreferences.Default["network.proxy.http_port"] = Convert.ToInt32(ayrac[1]);
                        baglanti_turu = "HTTP";
                        break;

                    case "s":
                        GeckoPreferences.Default["network.proxy.http"]      = ayrac[0];
                        GeckoPreferences.Default["network.proxy.http_port"] = Convert.ToInt32(ayrac[1]);
                        GeckoPreferences.Default["network.proxy.ssl"]       = ayrac[0];
                        GeckoPreferences.Default["network.proxy.ssl_port"]  = Convert.ToInt32(ayrac[1]);
                        baglanti_turu = "HTTPS";
                        break;
                    }
                }

                geckoWebBrowser1.Navigate(url, GeckoLoadFlags.BypassHistory, referer_listesi[new Random().Next(0, referer_listesi.Count - 1)], null, null);

                Text = "Tarayıcı yönlendirildi: " + prxy_lstesi[basla];
                ((Form1)(Application.OpenForms["Form1"])).listBox3.Items.Add(url + " için tarayıcı " + prxy_lstesi[basla] + " adresinden yönlendirildi. Bağlantı Türü: " + baglanti_turu);
                basla         += 1;
                timer2.Enabled = true;
                timer1.Enabled = false;
            }
            else
            {
                ((Form1)(Application.OpenForms["Form1"])).listBox3.Items.Add(url + " için tıklama işlemleri bitti. " + "Toplam Tık: " + tik_sayisi.ToString());
                timer1.Enabled = false;
            }
        }
Пример #18
0
 private void CreateServiceReference(string contractID)
 {
     if (!Xpcom.IsInitialized)
     {
         throw new GeckoException("Xpcom.Initialize must be called before using of any xulrunner/gecko-fx services");
     }
     _instance = Xpcom.GetService <T>(contractID);
 }
Пример #19
0
        public static void XoaCookie()
        {
            nsICookieManager CookieMan;

            CookieMan = Xpcom.GetService <nsICookieManager>("@mozilla.org/cookiemanager;1");
            CookieMan = Xpcom.QueryInterface <nsICookieManager>(CookieMan);
            CookieMan.RemoveAll();
        }
Пример #20
0
 public void BeforeEachTestSetup()
 {
     Xpcom.Initialize(XpComTests.XulRunnerLocation);
     WindowMediator.Disable = true;
     if (_memoryService == null)
     {
         _memoryService = Xpcom.GetService <nsIMemory>("@mozilla.org/xpcom/memory-service;1");
     }
 }
Пример #21
0
        public void BeforeEachTestSetup()
        {
            Xpcom.Initialize(XpComTests.XulRunnerLocation);
            // defined in nsIXPConent.idl
            // CB6593E0-F9B2-11d2-BDD6-000064657374
            var ptr = (IntPtr)Xpcom.GetService(new Guid("CB6593E0-F9B2-11d2-BDD6-000064657374"));

            Assert.IsNotNull(ptr);
            m_instance = (nsIXPConnect)Xpcom.GetObjectForIUnknown(ptr);
            Assert.IsNotNull(m_instance);
        }
        public void BeforeEachTestSetup()
        {
            Xpcom.Initialize(XpComTests.XulRunnerLocation);
            //affecting browser.Realod()/GoForward()/GoBackward() of error page
            GeckoPreferences.User["browser.xul.error_pages.enabled"] = true;
            _browser = new GeckoWebBrowser();
            var unused = _browser.Handle;

            Assert.IsNotNull(_browser);
            _memoryService = Xpcom.GetService <nsIMemory>("@mozilla.org/xpcom/memory-service;1");
        }
Пример #23
0
        private void clear_cookie()
        {
            nsIBrowserHistory historyMan = Xpcom.GetService <nsIBrowserHistory>(Gecko.Contracts.NavHistoryService);

            historyMan = Xpcom.QueryInterface <nsIBrowserHistory>(historyMan);
            historyMan.RemoveAllPages();
            nsICookieManager CookieMan;

            CookieMan = Xpcom.GetService <nsICookieManager>("@mozilla.org/cookiemanager;1");
            CookieMan = Xpcom.QueryInterface <nsICookieManager>(CookieMan);
            CookieMan.RemoveAll();
        }
Пример #24
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //
            Xpcom.Initialize(String.Format("{0}\\xulrunner\\", Path.GetDirectoryName(Application.ExecutablePath)));
            nsICookieManager CookieMan;

            CookieMan = Xpcom.GetService <nsICookieManager>("@mozilla.org/cookiemanager;1");
            CookieMan = Xpcom.QueryInterface <nsICookieManager>(CookieMan);
            CookieMan.RemoveAll();
            //
            Application.Run(new frmMain());
        }
Пример #25
0
 private void Mesajidasectikdevambtn_Click(object sender, EventArgs e)
 {
     if (mesajidasectikdevambtn.BackgroundImage == null)
     {
         islemloglabel.Text = "";
         nsICookieManager CookieMan;
         CookieMan = Xpcom.GetService <nsICookieManager>("@mozilla.org/cookiemanager;1");
         CookieMan = Xpcom.QueryInterface <nsICookieManager>(CookieMan);
         CookieMan.RemoveAll();
         MessageBox.Show("Yeni gönderim başlatılıyor3");
         Gizle();
         barkoduokutpnl.Visible = true;
         Wpbarkodvemesaj();
     }
 }
Пример #26
0
        /// <summary>
        /// Unittest helper method to create a String JsVal
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        private static JsVal CreateJsVal(string jscript)
        {
            using (AutoJSContext cx = new AutoJSContext(GlobalJSContextHolder.BackstageJSContext))
            {
                var ptr = new JsVal();
                var _securityManager = Xpcom.GetService <nsIScriptSecurityManager>("@mozilla.org/scriptsecuritymanager;1");
                var _systemPrincipal = _securityManager.GetSystemPrincipal();

                IntPtr globalObject = SpiderMonkey.JS_GetGlobalForScopeChain(cx.ContextPointer);
                bool   ret          = SpiderMonkey.JS_EvaluateScript(cx.ContextPointer, globalObject, jscript, (uint)jscript.Length, "script", 1, ref ptr);
                Assert.IsTrue(ret);
                Marshal.ReleaseComObject(_securityManager);

                return(ptr);
            }
        }
        void clearCookie()
        {
            nsICookieManager CookieMan;

            CookieMan = Xpcom.GetService <nsICookieManager>("@mozilla.org/cookiemanager;1");
            CookieMan = Xpcom.QueryInterface <nsICookieManager>(CookieMan);
            CookieMan.RemoveAll();

            ////nsIBrowserHistory historyMan = Xpcom.GetService<nsIBrowserHistory>(Gecko.Contracts.NavHistoryService);
            ////historyMan = Xpcom.QueryInterface<nsIBrowserHistory>(historyMan);
            ////historyMan.RemoveAllPages();

            //// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/imgICache
            //ImageCache.ClearCache(true);
            //ImageCache.ClearCache(false);
            //// Defaults to all devices(0) - https://bitbucket.org/geckofx/geckofx-9.0/issue/7/idl-translation-bug-for-enums
            //CacheService.Clear(new CacheStoragePolicy());
        }
Пример #28
0
        // From Timothy N in https://bitbucket.org/geckofx/geckofx-29.0/issue/34/how-to-download-files-using-this-engine
        static void LauncherDialog_Download(IWin32Window owner, object sender, LauncherDialogEvent e)
        {
            uint flags = (uint)nsIWebBrowserPersistConsts.PERSIST_FLAGS_NO_CONVERSION |
                         (uint)nsIWebBrowserPersistConsts.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
                         (uint)nsIWebBrowserPersistConsts.PERSIST_FLAGS_BYPASS_CACHE;
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.FileName = e.Filename;
            if (sfd.ShowDialog(owner) == DialogResult.OK)
            {
                // the part that do the download, may be used for automation, or when the source URI is known, or after a parse of the dom :
                string url      = e.Url;             //url to download
                string fullpath = sfd.FileName;      //destination file absolute path
                nsIWebBrowserPersist persist = Xpcom.GetService <nsIWebBrowserPersist>("@mozilla.org/embedding/browser/nsWebBrowserPersist;1");
                nsIURI source = IOService.CreateNsIUri(url);
                nsIURI dest   = IOService.CreateNsIUri(new Uri(fullpath).AbsoluteUri);
                persist.SetPersistFlagsAttribute(flags);
                persist.SaveURI(source, null, null, null, null, (nsISupports)dest, null);
                // file is saved - asynchronous call
                // need to try to have a temp name while the file is downloaded eg filename.ext.geckodownload (one of the SaveURI option)
            }
        }
        public void ManualCreateAndFree()
        {
            // create 3 instances
            var categoryManager1 = Xpcom.GetService <nsICategoryManager>(Contracts.CategoryManager);
            var categoryManager2 = Xpcom.GetService <nsICategoryManager>(Contracts.CategoryManager);
            var categoryManager3 = Xpcom.GetService <nsICategoryManager>(Contracts.CategoryManager);

            // they are equals
            Assert.AreEqual(categoryManager1, categoryManager2);
            Assert.AreEqual(categoryManager2, categoryManager3);

            // release ONE instance
            int count = Marshal.ReleaseComObject(categoryManager3);

            // we must have 2 instances
            Assert.AreEqual(count, 2);

            count = Marshal.ReleaseComObject(categoryManager2);
            Assert.AreEqual(count, 1);
            count = Marshal.ReleaseComObject(categoryManager1);
            Assert.AreEqual(count, 0);
        }
Пример #30
0
        public void UrlTest()
        {
            var service = Xpcom.GetService <nsIIOService>(Contracts.NetworkIOService);

            nsIURI ret;

            using (var str = new nsAUTF8String("http://www.google.com"))
            {
                ret = service.NewURI(str, null, null);
            }

            var ret2 = Xpcom.QueryInterface <nsIURL>(ret);

            var counter = Marshal.ReleaseComObject(ret);

            Assert.AreEqual(counter, 1);
            var serviceCounter = Marshal.ReleaseComObject(service);

            // Xpcom.GetService ref + 1
            // IOService static contrustor ref + 1
#if false
            Assert.AreEqual(serviceCounter, 0);
#endif
        }