nsresult LaunchHelper(nsAutoString& aPath, nsAutoString& aParams) { SHELLEXECUTEINFOW executeInfo = {0}; executeInfo.cbSize = sizeof(SHELLEXECUTEINFOW); executeInfo.hwnd = NULL; executeInfo.fMask = SEE_MASK_NOCLOSEPROCESS; executeInfo.lpDirectory = NULL; executeInfo.lpFile = aPath.get(); executeInfo.lpParameters = aParams.get(); executeInfo.nShow = SW_SHOWNORMAL; if (ShellExecuteExW(&executeInfo)) // Block until the program exits WaitForSingleObject(executeInfo.hProcess, INFINITE); else return NS_ERROR_ABORT; // We're going to ignore errors here since there's nothing we can do about // them, and helper.exe seems to return non-zero ret on success. return NS_OK; }
void nsHtml5Highlighter::Start(const nsAutoString& aTitle) { // Doctype mOpQueue.AppendElement()->Init(nsGkAtoms::html, EmptyString(), EmptyString()); mOpQueue.AppendElement()->Init(STANDARDS_MODE); nsIContent** root = CreateElement(nsHtml5Atoms::html, nullptr); mOpQueue.AppendElement()->Init(eTreeOpAppendToDocument, root); mStack.AppendElement(root); Push(nsGkAtoms::head, nullptr); Push(nsGkAtoms::title, nullptr); // XUL will add the "Source of: " prefix. uint32_t length = aTitle.Length(); if (length > INT32_MAX) { length = INT32_MAX; } AppendCharacters(aTitle.get(), 0, (int32_t)length); Pop(); // title Push(nsGkAtoms::link, nsHtml5ViewSourceUtils::NewLinkAttributes()); mOpQueue.AppendElement()->Init(eTreeOpUpdateStyleSheet, CurrentNode()); Pop(); // link Pop(); // head Push(nsGkAtoms::body, nsHtml5ViewSourceUtils::NewBodyAttributes()); nsHtml5HtmlAttributes* preAttrs = new nsHtml5HtmlAttributes(0); nsString* preId = new nsString(NS_LITERAL_STRING("line1")); preAttrs->addAttribute(nsHtml5AttributeName::ATTR_ID, preId); Push(nsGkAtoms::pre, preAttrs); StartCharacters(); mOpQueue.AppendElement()->Init(eTreeOpStartLayout); }