diff --git a/chrome/src/nsChromeRegistry.cpp b/chrome/src/nsChromeRegistry.cpp index d8cfd08c14fa..3787764d7af2 100644 --- a/chrome/src/nsChromeRegistry.cpp +++ b/chrome/src/nsChromeRegistry.cpp @@ -86,9 +86,9 @@ nsChromeRegistry::LogMessageWithContext(nsIURI* aURL, uint32_t aLineNumber, uint if (aURL) aURL->GetSpec(spec); - rv = error->Init(NS_ConvertUTF8toUTF16(formatted).get(), - NS_ConvertUTF8toUTF16(spec).get(), - nullptr, + rv = error->Init(NS_ConvertUTF8toUTF16(formatted), + NS_ConvertUTF8toUTF16(spec), + EmptyString(), aLineNumber, 0, flags, "chrome registration"); PR_smprintf_free(formatted); diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 3b0a9e79dd23..23089ad7deb0 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -3260,9 +3260,9 @@ nsContentUtils::ReportToConsole(uint32_t aErrorFlags, do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); - rv = errorObject->InitWithWindowID(errorText.get(), - NS_ConvertUTF8toUTF16(spec).get(), // file name - aSourceLine.get(), + rv = errorObject->InitWithWindowID(errorText, + NS_ConvertUTF8toUTF16(spec), // file name + aSourceLine, aLineNumber, aColumnNumber, aErrorFlags, aCategory, innerWindowID); diff --git a/content/base/src/nsEventSource.cpp b/content/base/src/nsEventSource.cpp index 1c8604107d59..cd7743a2e3e5 100644 --- a/content/base/src/nsEventSource.cpp +++ b/content/base/src/nsEventSource.cpp @@ -1093,9 +1093,9 @@ nsEventSource::PrintErrorOnConsole(const char *aBundleURI, } NS_ENSURE_SUCCESS(rv, rv); - rv = errObj->InitWithWindowID(message.get(), - mScriptFile.get(), - nullptr, + rv = errObj->InitWithWindowID(message, + mScriptFile, + EmptyString(), mScriptLine, 0, nsIScriptError::errorFlag, "Event Source", mInnerWindowID); diff --git a/content/base/src/nsFrameMessageManager.cpp b/content/base/src/nsFrameMessageManager.cpp index e78c561e6e29..5e9141122696 100644 --- a/content/base/src/nsFrameMessageManager.cpp +++ b/content/base/src/nsFrameMessageManager.cpp @@ -683,10 +683,10 @@ ContentScriptErrorReporter(JSContext* aCx, if (aReport) { if (aReport->ucmessage) { - message.Assign(reinterpret_cast(aReport->ucmessage)); + message.Assign(static_cast(aReport->ucmessage)); } filename.AssignWithConversion(aReport->filename); - line.Assign(reinterpret_cast(aReport->uclinebuf)); + line.Assign(static_cast(aReport->uclinebuf)); lineNumber = aReport->lineno; columnNumber = aReport->uctokenptr - aReport->uclinebuf; flags = aReport->flags; @@ -700,7 +700,7 @@ ContentScriptErrorReporter(JSContext* aCx, message.AssignWithConversion(aMessage); } - rv = scriptError->Init(message.get(), filename.get(), line.get(), + rv = scriptError->Init(message, filename, line, lineNumber, columnNumber, flags, "Message manager content script"); if (NS_FAILED(rv)) { @@ -731,7 +731,7 @@ ContentScriptErrorReporter(JSContext* aCx, error.AppendInt(lineNumber, 10); error.Append(": "); if (aReport->ucmessage) { - AppendUTF16toUTF8(reinterpret_cast(aReport->ucmessage), + AppendUTF16toUTF8(static_cast(aReport->ucmessage), error); } else { error.Append(aMessage); diff --git a/content/base/src/nsWebSocket.cpp b/content/base/src/nsWebSocket.cpp index 0559af7574c3..526c9432f42a 100644 --- a/content/base/src/nsWebSocket.cpp +++ b/content/base/src/nsWebSocket.cpp @@ -130,9 +130,9 @@ nsWebSocket::PrintErrorOnConsole(const char *aBundleURI, } NS_ENSURE_SUCCESS(rv, rv); - rv = errorObject->InitWithWindowID(message.get(), - NS_ConvertUTF8toUTF16(mScriptFile).get(), - nullptr, mScriptLine, 0, + rv = errorObject->InitWithWindowID(message, + NS_ConvertUTF8toUTF16(mScriptFile), + EmptyString(), mScriptLine, 0, nsIScriptError::errorFlag, "Web Socket", mInnerWindowID); NS_ENSURE_SUCCESS(rv, rv); diff --git a/content/xbl/src/nsXBLDocumentInfo.cpp b/content/xbl/src/nsXBLDocumentInfo.cpp index 3686124cf12e..87d4c730380c 100644 --- a/content/xbl/src/nsXBLDocumentInfo.cpp +++ b/content/xbl/src/nsXBLDocumentInfo.cpp @@ -218,10 +218,15 @@ XBL_ProtoErrorReporter(JSContext *cx, if (errorObject && consoleService) { uint32_t column = report->uctokenptr - report->uclinebuf; + const PRUnichar* ucmessage = + static_cast(report->ucmessage); + const PRUnichar* uclinebuf = + static_cast(report->uclinebuf); + errorObject->Init - (reinterpret_cast(report->ucmessage), - NS_ConvertUTF8toUTF16(report->filename).get(), - reinterpret_cast(report->uclinebuf), + (ucmessage ? nsDependentString(ucmessage) : EmptyString(), + NS_ConvertUTF8toUTF16(report->filename), + uclinebuf ? nsDependentString(uclinebuf) : EmptyString(), report->lineno, column, report->flags, "xbl javascript" ); diff --git a/content/xml/document/src/nsXMLDocument.cpp b/content/xml/document/src/nsXMLDocument.cpp index 4e03446a235d..16b2c09117c2 100644 --- a/content/xml/document/src/nsXMLDocument.cpp +++ b/content/xml/document/src/nsXMLDocument.cpp @@ -368,8 +368,10 @@ nsXMLDocument::Load(const nsAString& aUrl, bool *aReturn) do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); - rv = errorObject->InitWithWindowID(error.get(), NS_ConvertUTF8toUTF16(spec).get(), - nullptr, 0, 0, nsIScriptError::warningFlag, + rv = errorObject->InitWithWindowID(error, + NS_ConvertUTF8toUTF16(spec), + EmptyString(), + 0, 0, nsIScriptError::warningFlag, "DOM", callingDoc ? callingDoc->InnerWindowID() : diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index d57d9522dc99..a07ec7049115 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -1953,9 +1953,9 @@ PrintWarningOnConsole(JSContext *cx, const char *stringBundleProperty) } } - nsresult rv = scriptError->InitWithWindowID(msg.get(), - sourcefile.get(), - EmptyString().get(), + nsresult rv = scriptError->InitWithWindowID(msg, + sourcefile, + EmptyString(), lineno, 0, // column for error is not available nsIScriptError::warningFlag, @@ -5986,9 +5986,9 @@ IDBConstantGetter(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHan do_CreateInstance(NS_SCRIPTERROR_CONTRACTID); NS_WARN_IF_FALSE(errorObject, "Failed to create error object"); if (errorObject) { - nsresult rv = errorObject->InitWithWindowID(warnText.get(), - nullptr, // file name - nullptr, // source line + nsresult rv = errorObject->InitWithWindowID(warnText, + EmptyString(), // file name + EmptyString(), // source line 0, 0, // Line/col number nsIScriptError::warningFlag, "DOM Core", windowID); diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index d0e3b7c661da..b0d10773c81b 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -401,8 +401,8 @@ public: ? "chrome javascript" : "content javascript"; - rv = errorObject->InitWithWindowID(mErrorMsg.get(), mFileName.get(), - mSourceLine.get(), + rv = errorObject->InitWithWindowID(mErrorMsg, mFileName, + mSourceLine, mLineNr, mColumn, mFlags, category, mInnerWindowID); diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index 790ae7e320dc..8e20dce49df9 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -364,6 +364,10 @@ IndexedDatabaseManager::FireWindowOnError(nsPIDOMWindow* aOwner, nsScriptErrorEvent event(true, NS_LOAD_ERROR); request->FillScriptErrorEvent(&event); + NS_ABORT_IF_FALSE(event.fileName, + "FillScriptErrorEvent should give us a non-null string " + "for our error's fileName"); + event.errorMsg = errorName.get(); nsCOMPtr sgo(do_QueryInterface(aOwner)); @@ -385,9 +389,9 @@ IndexedDatabaseManager::FireWindowOnError(nsPIDOMWindow* aOwner, do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); - if (NS_FAILED(scriptError->InitWithWindowID(event.errorMsg, - event.fileName, - nullptr, event.lineNr, + if (NS_FAILED(scriptError->InitWithWindowID(errorName, + nsDependentString(event.fileName), + EmptyString(), event.lineNr, 0, 0, "IndexedDB", aOwner->WindowID()))) { diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index fae1e9d33ee0..1d01905f674c 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1797,7 +1797,7 @@ ContentParent::RecvScriptError(const nsString& aMessage, return true; nsCOMPtr msg(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID)); - nsresult rv = msg->Init(aMessage.get(), aSourceName.get(), aSourceLine.get(), + nsresult rv = msg->Init(aMessage, aSourceName, aSourceLine, aLineNumber, aColNumber, aFlags, aCategory.get()); if (NS_FAILED(rv)) return true; diff --git a/dom/sms/tests/marionette/manifest.ini b/dom/sms/tests/marionette/manifest.ini index e6fed6e3e408..1ecb4d23d677 100644 --- a/dom/sms/tests/marionette/manifest.ini +++ b/dom/sms/tests/marionette/manifest.ini @@ -5,3 +5,4 @@ qemu = true [test_between_emulators.py] [test_incoming.js] +[test_outgoing.js] diff --git a/dom/sms/tests/marionette/test_outgoing.js b/dom/sms/tests/marionette/test_outgoing.js new file mode 100644 index 000000000000..f178878e3756 --- /dev/null +++ b/dom/sms/tests/marionette/test_outgoing.js @@ -0,0 +1,143 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 20000; + +SpecialPowers.setBoolPref("dom.sms.enabled", true); +SpecialPowers.addPermission("sms", true, document); +SpecialPowers.addPermission("mobileconnection", true, document); + +let sms = window.navigator.mozSms; +let receiver = "5555552368"; +let body = "Hello SMS world!"; + +function checkSentMessage(message, sentDate) { + ok(message, "message is valid"); + ok(message instanceof MozSmsMessage, + "message is instanceof " + message.constructor); + + ok(message.id, "message.id is valid"); + is(message.delivery, "sent", "message.delivery"); + is(message.sender, null, "message.sender"); + is(message.receiver, receiver, "message.receiver"); + is(message.body, body, "message.body"); + ok(message.timestamp instanceof Date, + "message.timestamp is instanceof " + message.timestamp.constructor); + // SMSC timestamp is in seconds. + ok(Math.floor(message.timestamp.getTime() / 1000) >= Math.floor(sentDate / 1000), + "sent timestamp is valid"); + is(message.read, true, "message.read"); +} + +let sentMessages = null; +function checkSameSentMessage(message, now) { + checkSentMessage(message, now); + + let sentMessage = sentMessages[message.id]; + if (!sentMessage) { + sentMessages[message.id] = message; + return; + } + + // The two message instance should be exactly the same, but since we had + // already checked most attributes of them, we only compare their + // timestamps here. + ok(sentMessage.timestamp.getTime() == message.timestamp.getTime(), + "the messages got from onsent event and request result must be the same"); +} + +function doSendMessageAndCheckSuccess(receivers, callback) { + sentMessages = []; + + let now = Date.now(); + let count; + + function done() { + if (--count > 0) { + return; + } + + sms.removeEventListener("sent", onSmsSent); + setTimeout(callback, 0); + } + + function onSmsSent(event) { + log("SmsManager.onsent event received."); + + ok(event instanceof MozSmsEvent, + "event is instanceof " + event.constructor); + // Event listener is removed in done(). + + checkSameSentMessage(event.message, now); + + done(); + } + + function onRequestSuccess(event) { + log("SmsRequest.onsuccess event received."); + + ok(event.target instanceof MozSmsRequest, + "event.target is instanceof " + event.target.constructor); + event.target.removeEventListener("success", onRequestSuccess); + + checkSameSentMessage(event.target.result, now); + + done(); + } + + sms.addEventListener("sent", onSmsSent); + + let result = sms.send(receivers, body); + if (Array.isArray(receivers)) { + ok(Array.isArray(result), + "send() returns an array of requests if receivers is an array"); + is(result.length, receivers.length, "returned array length"); + + // `receivers` is an array, so we have N request.onsuccess and N sms.onsent. + count = result.length * 2; + + for (let i = 0; i < result.length; i++) { + let request = result[i]; + ok(request instanceof MozSmsRequest, + "request is instanceof " + request.constructor); + request.addEventListener("success", onRequestSuccess); + } + + return; + } + + // `receivers` is not an array, so we have one request.onsuccess and one + // sms.onsent. + count = 2; + + let request = result; + ok(request instanceof MozSmsRequest, + "request is instanceof " + request.constructor); + request.addEventListener("success", onRequestSuccess); +} + +function testSendMessage() { + log("Testing sending message to one receiver:"); + doSendMessageAndCheckSuccess(receiver, testSendMessageToMultipleRecipients); +} + +function testSendMessageToMultipleRecipients() { + log("Testing sending message to multiple receivers:"); + // TODO: bug 788928 - add test cases for nsIDOMSmsManager.ondelivered event + doSendMessageAndCheckSuccess([receiver, receiver], cleanUp); +} + +function cleanUp() { + SpecialPowers.removePermission("sms", document); + SpecialPowers.removePermission("mobileconnection", document); + finish(); +} + +waitFor(testSendMessage, function () { + let connected = navigator.mozMobileConnection.voice.connected; + if (!connected) { + log("MobileConnection is not ready yet."); + } + return connected; +}); + diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js index fa87d771cdf6..3f90f87058c2 100644 --- a/dom/system/gonk/RadioInterfaceLayer.js +++ b/dom/system/gonk/RadioInterfaceLayer.js @@ -34,6 +34,7 @@ const nsIRadioInterfaceLayer = Ci.nsIRadioInterfaceLayer; const kNetworkInterfaceStateChangedTopic = "network-interface-state-changed"; const kSmsReceivedObserverTopic = "sms-received"; +const kSmsSentObserverTopic = "sms-sent"; const kSmsDeliveredObserverTopic = "sms-delivered"; const kMozSettingsChangedObserverTopic = "mozsettings-changed"; const kSysMsgListenerReadyObserverTopic = "system-message-listener-ready"; @@ -1018,6 +1019,8 @@ RadioInterfaceLayer.prototype = { } gSmsRequestManager.notifySmsSent(options.requestId, sms); + + Services.obs.notifyObservers(options.sms, kSmsSentObserverTopic, null); }, handleSmsDelivered: function handleSmsDelivered(message) { diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index 6c6c6bf961f9..06e11fc69a90 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -2898,7 +2898,7 @@ let RIL = { let messageStringLength = Buf.readUint32(); if (DEBUG) debug("Got new SMS, length " + messageStringLength); let message = GsmPDUHelper.readMessage(); - if (DEBUG) debug(message); + if (DEBUG) debug("Got new SMS: " + JSON.stringify(message)); // Read string delimiters. See Buf.readString(). Buf.readStringDelimiter(length); @@ -2958,11 +2958,13 @@ let RIL = { _processSmsStatusReport: function _processSmsStatusReport(length) { let message = this._processReceivedSms(length); if (!message) { + if (DEBUG) debug("invalid SMS-STATUS-REPORT"); return PDU_FCS_UNSPECIFIED; } let options = this._pendingSentSmsMap[message.messageRef]; if (!options) { + if (DEBUG) debug("no pending SMS-SUBMIT message"); return PDU_FCS_OK; } @@ -2985,12 +2987,14 @@ let RIL = { // Pending. Waiting for next status report. if ((status >>> 5) == 0x01) { + if (DEBUG) debug("SMS-STATUS-REPORT: delivery still pending"); return PDU_FCS_OK; } delete this._pendingSentSmsMap[message.messageRef]; if ((status >>> 5) != 0x00) { + if (DEBUG) debug("SMS-STATUS-REPORT: delivery failed"); // It seems unlikely to get a result code for a failure to deliver. // Even if, we don't want to do anything with this. return PDU_FCS_OK; @@ -3525,6 +3529,7 @@ RIL[REQUEST_SEND_SMS] = function REQUEST_SEND_SMS(length, options) { options.errorCode = Buf.readUint32(); if (options.requestStatusReport) { + if (DEBUG) debug("waiting SMS-STATUS-REPORT for messageRef " + options.messageRef); this._pendingSentSmsMap[options.messageRef] = options; } diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 74a158cc5ba7..7100d23abc1e 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -1073,9 +1073,9 @@ public: NS_WARN_IF_FALSE(scriptError, "Failed to create script error!"); if (scriptError) { - if (NS_FAILED(scriptError->InitWithWindowID(aMessage.get(), - aFilename.get(), - aLine.get(), aLineNumber, + if (NS_FAILED(scriptError->InitWithWindowID(aMessage, + aFilename, + aLine, aLineNumber, aColumnNumber, aFlags, "Web Worker", aInnerWindowId))) { diff --git a/image/src/Decoder.cpp b/image/src/Decoder.cpp index 072afec44b25..f408daf0fe51 100644 --- a/image/src/Decoder.cpp +++ b/image/src/Decoder.cpp @@ -106,9 +106,9 @@ Decoder::Finish() NS_ConvertASCIItoUTF16(mImage.GetURIString())); if (NS_SUCCEEDED(errorObject->InitWithWindowID( - msg.get(), - NS_ConvertUTF8toUTF16(mImage.GetURIString()).get(), - nullptr, 0, 0, nsIScriptError::errorFlag, + msg, + NS_ConvertUTF8toUTF16(mImage.GetURIString()), + EmptyString(), 0, 0, nsIScriptError::errorFlag, "Image", mImage.InnerWindowID() ))) { consoleService->LogMessage(errorObject); diff --git a/js/xpconnect/idl/nsIScriptError.idl b/js/xpconnect/idl/nsIScriptError.idl index 4953235db839..81f83398e50a 100644 --- a/js/xpconnect/idl/nsIScriptError.idl +++ b/js/xpconnect/idl/nsIScriptError.idl @@ -11,7 +11,7 @@ #include "nsISupports.idl" #include "nsIConsoleMessage.idl" -[scriptable, uuid(c6dd877a-87b6-47cc-968d-90f4514ec65f)] +[scriptable, uuid(ddc19b34-e22e-46d5-9f7f-c7768a7dc50a)] interface nsIScriptError : nsIConsoleMessage { /** pseudo-flag for default case */ @@ -66,9 +66,9 @@ interface nsIScriptError : nsIConsoleMessage returned if init() was used instead of initWithWindowID(). */ readonly attribute unsigned long long innerWindowID; - void init(in wstring message, - in wstring sourceName, - in wstring sourceLine, + void init(in AString message, + in AString sourceName, + in AString sourceLine, in uint32_t lineNumber, in uint32_t columnNumber, in uint32_t flags, @@ -77,9 +77,9 @@ interface nsIScriptError : nsIConsoleMessage /* This should be called instead of nsIScriptError.init to initialize with a window id. The window id should be for the inner window associated with this error. */ - void initWithWindowID(in wstring message, - in wstring sourceName, - in wstring sourceLine, + void initWithWindowID(in AString message, + in AString sourceName, + in AString sourceLine, in uint32_t lineNumber, in uint32_t columnNumber, in uint32_t flags, diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp index d4317331d017..f4f6df4775c8 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -125,21 +125,19 @@ mozJSLoaderErrorReporter(JSContext *cx, const char *message, JSErrorReport *rep) do_CreateInstance(NS_SCRIPTERROR_CONTRACTID); if (consoleService && errorObject) { - /* - * Got an error object; prepare appropriate-width versions of - * various arguments to it. - */ - NS_ConvertASCIItoUTF16 fileUni(rep->filename); - uint32_t column = rep->uctokenptr - rep->uclinebuf; - rv = errorObject->Init(reinterpret_cast - (rep->ucmessage), - fileUni.get(), - reinterpret_cast - (rep->uclinebuf), - rep->lineno, column, rep->flags, - "component javascript"); + const PRUnichar* ucmessage = + static_cast(rep->ucmessage); + const PRUnichar* uclinebuf = + static_cast(rep->uclinebuf); + + rv = errorObject->Init( + ucmessage ? nsDependentString(ucmessage) : EmptyString(), + NS_ConvertASCIItoUTF16(rep->filename), + uclinebuf ? nsDependentString(uclinebuf) : EmptyString(), + rep->lineno, column, rep->flags, + "component javascript"); if (NS_SUCCEEDED(rv)) { rv = consoleService->LogMessage(errorObject); if (NS_SUCCEEDED(rv)) { diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index 3a6236be1710..2dc2055f4409 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -2784,9 +2784,16 @@ nsXPCComponents_Utils::ReportError(const JS::Value &error, JSContext *cx) uint32_t column = err->uctokenptr - err->uclinebuf; + const PRUnichar* ucmessage = + static_cast(err->ucmessage); + const PRUnichar* uclinebuf = + static_cast(err->uclinebuf); + nsresult rv = scripterr->InitWithWindowID( - static_cast(err->ucmessage), fileUni.get(), - static_cast(err->uclinebuf), err->lineno, + ucmessage ? nsDependentString(ucmessage) : EmptyString(), + fileUni, + uclinebuf ? nsDependentString(uclinebuf) : EmptyString(), + err->lineno, column, err->flags, "XPConnect JavaScript", innerWindowID); NS_ENSURE_SUCCESS(rv, NS_OK); @@ -2817,9 +2824,9 @@ nsXPCComponents_Utils::ReportError(const JS::Value &error, JSContext *cx) return NS_OK; nsresult rv = scripterr->InitWithWindowID( - reinterpret_cast(msgchars), - NS_ConvertUTF8toUTF16(fileName).get(), - nullptr, lineNo, 0, 0, "XPConnect JavaScript", innerWindowID); + nsDependentString(static_cast(msgchars)), + NS_ConvertUTF8toUTF16(fileName), + EmptyString(), lineNo, 0, 0, "XPConnect JavaScript", innerWindowID); NS_ENSURE_SUCCESS(rv, NS_OK); console->LogMessage(scripterr); diff --git a/js/xpconnect/src/XPCConvert.cpp b/js/xpconnect/src/XPCConvert.cpp index 1e4d2638f093..302c0860bead 100644 --- a/js/xpconnect/src/XPCConvert.cpp +++ b/js/xpconnect/src/XPCConvert.cpp @@ -1350,24 +1350,25 @@ XPCConvert::JSErrorToXPCException(XPCCallContext& ccx, if (report) { nsAutoString bestMessage; if (report && report->ucmessage) { - bestMessage = (const PRUnichar *)report->ucmessage; + bestMessage = static_cast(report->ucmessage); } else if (message) { CopyASCIItoUTF16(message, bestMessage); } else { bestMessage.AssignLiteral("JavaScript Error"); } + const PRUnichar* uclinebuf = + static_cast(report->uclinebuf); + data = new nsScriptError(); - if (!data) - return NS_ERROR_OUT_OF_MEMORY; - - - data->InitWithWindowID(bestMessage.get(), - NS_ConvertASCIItoUTF16(report->filename).get(), - (const PRUnichar *)report->uclinebuf, report->lineno, - report->uctokenptr - report->uclinebuf, report->flags, - "XPConnect JavaScript", - nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(ccx.GetJSContext())); + data->InitWithWindowID( + bestMessage, + NS_ConvertASCIItoUTF16(report->filename), + uclinebuf ? nsDependentString(uclinebuf) : EmptyString(), + report->lineno, + report->uctokenptr - report->uclinebuf, report->flags, + "XPConnect JavaScript", + nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(ccx.GetJSContext())); } if (data) { diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index 1d3efc523d2e..4ee6610cf234 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -1081,9 +1081,9 @@ nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx, rv = location->GetFilename(getter_Copies(sourceName)); } - rv = scriptError->InitWithWindowID(newMessage.get(), - NS_ConvertASCIItoUTF16(sourceName).get(), - nullptr, + rv = scriptError->InitWithWindowID(newMessage, + NS_ConvertASCIItoUTF16(sourceName), + EmptyString(), lineNumber, 0, 0, "XPConnect JavaScript", nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(cx)); diff --git a/js/xpconnect/src/nsScriptError.cpp b/js/xpconnect/src/nsScriptError.cpp index 3fb7e0a85c49..c4a1cf0656fe 100644 --- a/js/xpconnect/src/nsScriptError.cpp +++ b/js/xpconnect/src/nsScriptError.cpp @@ -91,9 +91,9 @@ nsScriptError::GetCategory(char **result) { } NS_IMETHODIMP -nsScriptError::Init(const PRUnichar *message, - const PRUnichar *sourceName, - const PRUnichar *sourceLine, +nsScriptError::Init(const nsAString& message, + const nsAString& sourceName, + const nsAString& sourceLine, uint32_t lineNumber, uint32_t columnNumber, uint32_t flags, @@ -104,9 +104,9 @@ nsScriptError::Init(const PRUnichar *message, } NS_IMETHODIMP -nsScriptError::InitWithWindowID(const PRUnichar *message, - const PRUnichar *sourceName, - const PRUnichar *sourceLine, +nsScriptError::InitWithWindowID(const nsAString& message, + const nsAString& sourceName, + const nsAString& sourceLine, uint32_t lineNumber, uint32_t columnNumber, uint32_t flags, diff --git a/layout/style/nsCSSScanner.cpp b/layout/style/nsCSSScanner.cpp index e405e4217d37..a6e30215f9ed 100644 --- a/layout/style/nsCSSScanner.cpp +++ b/layout/style/nsCSSScanner.cpp @@ -406,9 +406,9 @@ nsCSSScanner::OutputError() do_CreateInstance(gScriptErrorFactory, &rv); if (NS_SUCCEEDED(rv)) { - rv = errorObject->InitWithWindowID(mError.get(), - NS_ConvertUTF8toUTF16(mFileName).get(), - EmptyString().get(), + rv = errorObject->InitWithWindowID(mError, + NS_ConvertUTF8toUTF16(mFileName), + EmptyString(), mErrorLineNumber, mErrorColNumber, nsIScriptError::warningFlag, diff --git a/layout/style/nsFontFaceLoader.cpp b/layout/style/nsFontFaceLoader.cpp index beddffbd8fd4..6b84e23b3857 100644 --- a/layout/style/nsFontFaceLoader.cpp +++ b/layout/style/nsFontFaceLoader.cpp @@ -779,9 +779,9 @@ nsUserFontSet::LogMessage(gfxProxyFontEntry *aProxy, NS_ENSURE_SUCCESS(rv, rv); uint64_t innerWindowID = GetPresContext()->Document()->InnerWindowID(); - rv = scriptError->InitWithWindowID(NS_ConvertUTF8toUTF16(msg).get(), - href.get(), // file - text.get(), // src line + rv = scriptError->InitWithWindowID(NS_ConvertUTF8toUTF16(msg), + href, // file + text, // src line 0, 0, // line & column number aFlags, // flags "CSS Loader", // category (make separate?) diff --git a/layout/style/ua.css b/layout/style/ua.css index 229aa16adb96..e818300cddf6 100644 --- a/layout/style/ua.css +++ b/layout/style/ua.css @@ -220,7 +220,7 @@ } -*|*:-moz-full-screen { +*|*:not(:root):-moz-full-screen { position: fixed !important; top: 0 !important; left: 0 !important; diff --git a/parser/htmlparser/src/nsExpatDriver.cpp b/parser/htmlparser/src/nsExpatDriver.cpp index 441637f45311..e03d1d234b78 100644 --- a/parser/htmlparser/src/nsExpatDriver.cpp +++ b/parser/htmlparser/src/nsExpatDriver.cpp @@ -928,9 +928,9 @@ nsExpatDriver::HandleError() nsCOMPtr serr(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID)); nsresult rv = NS_ERROR_FAILURE; if (serr) { - rv = serr->InitWithWindowID(description.get(), - mURISpec.get(), - mLastLine.get(), + rv = serr->InitWithWindowID(description, + mURISpec, + mLastLine, lineNumber, colNumber, nsIScriptError::errorFlag, "malformed-xml", mInnerWindowID); diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp index 26a38080a44e..1dc41ea7588b 100644 --- a/xpcom/components/ManifestParser.cpp +++ b/xpcom/components/ManifestParser.cpp @@ -170,8 +170,8 @@ void LogMessageWithContext(FileLocation &aFile, if (!console) return; - nsresult rv = error->Init(NS_ConvertUTF8toUTF16(formatted).get(), - NS_ConvertUTF8toUTF16(file).get(), NULL, + nsresult rv = error->Init(NS_ConvertUTF8toUTF16(formatted), + NS_ConvertUTF8toUTF16(file), EmptyString(), aLineNumber, 0, nsIScriptError::warningFlag, "chrome registration"); if (NS_FAILED(rv)) diff --git a/xpcom/io/nsDirectoryService.cpp b/xpcom/io/nsDirectoryService.cpp index 233e58b6b46a..c1f01de40a0e 100644 --- a/xpcom/io/nsDirectoryService.cpp +++ b/xpcom/io/nsDirectoryService.cpp @@ -74,6 +74,8 @@ nsDirectoryService::GetCurrentProcessDirectory(nsIFile** aFile) rv = nsDirectoryService::Create(nullptr, NS_GET_IID(nsIProperties), getter_AddRefs(dirService)); // needs to be around for life of product + if (NS_FAILED(rv)) + return rv; if (dirService) {