res = nsComponentManager::CreateInstance(kDeviceContextCID, nsnull, kDeviceContextIID, (void **)&deviceContext);
res = CallCreateInstance(kDeviceContextCID, &deviceContext);
nsresult CoverageTest(int *argc, char **argv){    nsresult res = NS_InitXPCOM2(nsnull, nsnull, nsnull);    if (NS_FAILED(res))        return res;    // Create the Event Queue for the UI thread...    nsCOMPtr<nsIEventQueueService> eventQService =        do_GetService(kEventQueueServiceCID, &res);    if (NS_OK != res) {        NS_ASSERTION(PR_FALSE, "Could not obtain the event queue service");        return res;    }      // Create a application shell    nsIAppShell *appShell;    CallCreateInstance(kCAppShellCID, &appShell);    if (appShell != nsnull) {      fputs("Created AppShell\n", stderr);      appShell->Create(argc, argv);    } else {      printf("AppShell is null!\n");    }    nsIDeviceContext* deviceContext = 0;    // Create a device context for the widgets    static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);    static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID);    //    // create the main window    //    CallCreateInstance(kCWindowCID, &gWindow);    nsRect rect(100, 100, 600, 700);    gWindow->Create((nsIWidget*) nsnull, rect, HandleEvent,                    (nsIDeviceContext *) nsnull,                   appShell);    nsAutoString strTitle(NS_LITERAL_STRING("Pixel coverage test"));    gWindow->SetTitle(strTitle);    //    // Create Device Context based on main window    //    res = nsComponentManager::CreateInstance(kDeviceContextCID, nsnull, kDeviceContextIID, (void **)&deviceContext);    if (NS_OK == res)    {      deviceContext->Init(gWindow->GetNativeData(NS_NATIVE_WIDGET));      NS_ADDREF(deviceContext);    }    gWindow->Show(PR_TRUE);     return(appShell->Run());}