Bug 711721 - merge nsIScriptError and nsIScriptError2 interfaces; r=neil, sr=bzbarsky

This commit is contained in:
aceman
2011-12-21 16:51:29 -05:00
parent 0b922cf0bc
commit 8a85ef9b8e
19 changed files with 85 additions and 124 deletions

View File

@@ -1109,36 +1109,31 @@ public:
}
// Otherwise log an error to the error console.
nsCOMPtr<nsIScriptError2> scriptError =
nsCOMPtr<nsIScriptError> scriptError =
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
NS_WARN_IF_FALSE(scriptError, "Faild to create script error!");
nsCOMPtr<nsIConsoleMessage> consoleMessage;
NS_WARN_IF_FALSE(scriptError, "Failed to create script error!");
if (scriptError) {
if (NS_SUCCEEDED(scriptError->InitWithWindowID(aMessage.get(),
aFilename.get(),
aLine.get(), aLineNumber,
aColumnNumber, aFlags,
"Web Worker",
aInnerWindowId))) {
consoleMessage = do_QueryInterface(scriptError);
NS_ASSERTION(consoleMessage, "This should never fail!");
}
else {
if (NS_FAILED(scriptError->InitWithWindowID(aMessage.get(),
aFilename.get(),
aLine.get(), aLineNumber,
aColumnNumber, aFlags,
"Web Worker",
aInnerWindowId))) {
NS_WARNING("Failed to init script error!");
scriptError = nsnull;
}
}
nsCOMPtr<nsIConsoleService> consoleService =
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
NS_WARN_IF_FALSE(consoleService, "Faild to get console service!");
NS_WARN_IF_FALSE(consoleService, "Failed to get console service!");
bool logged = false;
if (consoleService) {
if (consoleMessage) {
if (NS_SUCCEEDED(consoleService->LogMessage(consoleMessage))) {
if (scriptError) {
if (NS_SUCCEEDED(consoleService->LogMessage(scriptError))) {
logged = true;
}
else {