diff --git a/accessible/public/nsIAccessibleRetrieval.idl b/accessible/public/nsIAccessibleRetrieval.idl index 2923fd0b365c..08c730222a42 100644 --- a/accessible/public/nsIAccessibleRetrieval.idl +++ b/accessible/public/nsIAccessibleRetrieval.idl @@ -18,7 +18,7 @@ interface nsIAccessiblePivot; * nsIAccessible for a given DOM node. More documentation at: * http://www.mozilla.org/projects/ui/accessibility */ -[scriptable, uuid(aed712cb-708b-4caa-981d-767be0fba984)] +[scriptable, uuid(17f86615-1a3d-4021-b227-3a2ef5cbffd8)] interface nsIAccessibleRetrieval : nsISupports { /** @@ -94,6 +94,11 @@ interface nsIAccessibleRetrieval : nsISupports * @see Logging.cpp for list of possible values. */ void setLogging(in ACString aModules); + + /** + * Return true if the given module is logged. + */ + boolean isLogged(in AString aModule); }; diff --git a/accessible/src/base/Logging.cpp b/accessible/src/base/Logging.cpp index b7da3754d55b..2f1ba9a7b6bd 100644 --- a/accessible/src/base/Logging.cpp +++ b/accessible/src/base/Logging.cpp @@ -35,6 +35,24 @@ struct ModuleRep { logging::EModules mModule; }; +static ModuleRep sModuleMap[] = { + { "docload", logging::eDocLoad }, + { "doccreate", logging::eDocCreate }, + { "docdestroy", logging::eDocDestroy }, + { "doclifecycle", logging::eDocLifeCycle }, + + { "events", logging::eEvents }, + { "platforms", logging::ePlatforms }, + { "stack", logging::eStack }, + { "text", logging::eText }, + { "tree", logging::eTree }, + + { "DOMEvents", logging::eDOMEvents }, + { "focus", logging::eFocus }, + { "selection", logging::eSelection }, + { "notifications", logging::eNotifications } +}; + static void EnableLogging(const char* aModulesStr) { @@ -42,31 +60,18 @@ EnableLogging(const char* aModulesStr) if (!aModulesStr) return; - static ModuleRep modules[] = { - { "docload", logging::eDocLoad }, - { "doccreate", logging::eDocCreate }, - { "docdestroy", logging::eDocDestroy }, - { "doclifecycle", logging::eDocLifeCycle }, - - { "events", logging::eEvents }, - { "platforms", logging::ePlatforms }, - { "stack", logging::eStack }, - { "text", logging::eText }, - { "tree", logging::eTree }, - - { "DOMEvents", logging::eDOMEvents }, - { "focus", logging::eFocus }, - { "selection", logging::eSelection }, - { "notifications", logging::eNotifications } - }; - const char* token = aModulesStr; while (*token != '\0') { size_t tokenLen = strcspn(token, ","); - for (unsigned int idx = 0; idx < ArrayLength(modules); idx++) { - if (strncmp(token, modules[idx].mStr, tokenLen) == 0) { - sModules |= modules[idx].mModule; - printf("\n\nmodule enabled: %s\n", modules[idx].mStr); + for (unsigned int idx = 0; idx < ArrayLength(sModuleMap); idx++) { + if (strncmp(token, sModuleMap[idx].mStr, tokenLen) == 0) { +#if !defined(MOZ_PROFILING) && (!defined(MOZ_DEBUG) || defined(MOZ_OPTIMIZE)) + // Stack tracing on profiling enabled or debug not optimized builds. + if (strncmp(token, "stack", tokenLen) == 0) + break; +#endif + sModules |= sModuleMap[idx].mModule; + printf("\n\nmodule enabled: %s\n", sModuleMap[idx].mStr); break; } } @@ -803,6 +808,17 @@ logging::IsEnabled(uint32_t aModules) return sModules & aModules; } +bool +logging::IsEnabled(const nsAString& aModuleStr) +{ + for (unsigned int idx = 0; idx < ArrayLength(sModuleMap); idx++) { + if (aModuleStr.EqualsASCII(sModuleMap[idx].mStr)) + return sModules & sModuleMap[idx].mModule; + } + + return false; +} + void logging::Enable(const nsAFlatCString& aModules) { diff --git a/accessible/src/base/Logging.h b/accessible/src/base/Logging.h index a67922141650..36f1b5e9e42e 100644 --- a/accessible/src/base/Logging.h +++ b/accessible/src/base/Logging.h @@ -50,6 +50,11 @@ enum EModules { */ bool IsEnabled(uint32_t aModules); +/** + * Return true if the given module is logged. + */ +bool IsEnabled(const nsAString& aModules); + /** * Log the document loading progress. */ diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index e52d1b26a789..9526a1fa4da1 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -250,6 +250,7 @@ nsAccessibilityService::ContentRangeInserted(nsIPresShell* aPresShell, logging::Node("content", child); } logging::MsgEnd(); + logging::Stack(); } #endif @@ -269,6 +270,7 @@ nsAccessibilityService::ContentRemoved(nsIPresShell* aPresShell, logging::Node("container", aContainer); logging::Node("content", aChild); logging::MsgEnd(); + logging::Stack(); } #endif @@ -620,6 +622,19 @@ nsAccessibilityService::SetLogging(const nsACString& aModules) return NS_OK; } +NS_IMETHODIMP +nsAccessibilityService::IsLogged(const nsAString& aModule, bool* aIsLogged) +{ + NS_ENSURE_ARG_POINTER(aIsLogged); + *aIsLogged = false; + +#ifdef A11Y_LOG + *aIsLogged = logging::IsEnabled(aModule); +#endif + + return NS_OK; +} + //////////////////////////////////////////////////////////////////////////////// // nsAccessibilityService public diff --git a/accessible/src/generic/HyperTextAccessible.cpp b/accessible/src/generic/HyperTextAccessible.cpp index fe3a4161202b..0112d28cc3bb 100644 --- a/accessible/src/generic/HyperTextAccessible.cpp +++ b/accessible/src/generic/HyperTextAccessible.cpp @@ -1497,6 +1497,14 @@ HyperTextAccessible::GetEditor() const nsresult HyperTextAccessible::SetSelectionRange(int32_t aStartPos, int32_t aEndPos) { + // Before setting the selection range, we need to ensure that the editor + // is initialized. (See bug 804927.) + // Otherwise, it's possible that lazy editor initialization will override + // the selection we set here and leave the caret at the end of the text. + // By calling GetEditor here, we ensure that editor initialization is + // completed before we set the selection. + nsCOMPtr editor = GetEditor(); + bool isFocusable = InteractiveState() & states::FOCUSABLE; // If accessible is focusable then focus it before setting the selection to diff --git a/accessible/tests/mochitest/common.js b/accessible/tests/mochitest/common.js index 47bf76cf3586..224d17e896cf 100644 --- a/accessible/tests/mochitest/common.js +++ b/accessible/tests/mochitest/common.js @@ -102,6 +102,10 @@ function disableLogging() { gAccRetrieval.setLogging(""); } +function isLogged(aModule) +{ + return gAccRetrieval.isLogged(aModule); +} /** * Invokes the given function when document is loaded and focused. Preferable diff --git a/accessible/tests/mochitest/name/markup.js b/accessible/tests/mochitest/name/markup.js index bb5a0f1d56fd..c89acc706947 100644 --- a/accessible/tests/mochitest/name/markup.js +++ b/accessible/tests/mochitest/name/markup.js @@ -14,7 +14,7 @@ var gDumpToConsole = false; */ function testNames() { - //enableLogging("tree"); // debugging + enableLogging("tree,stack"); // debugging var request = new XMLHttpRequest(); request.open("get", gNameRulesFileURL, false); @@ -141,8 +141,9 @@ function testNamesForMarkupRules(aMarkupElm, aContainer) gTestIterator.iterateRules.bind(gTestIterator, elm, aContainer, ruleElms); // Images may be recreated after we append them into subtree. We need to wait - // in this case. - if (isAccessible(elm)) + // in this case. If we are on profiling enabled build then stack tracing + // works and thus let's log instead. + if (isAccessible(elm) || isLogged("stack")) processMarkupRules(); else waitForEvent(EVENT_SHOW, elm, processMarkupRules); diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index b6ff28e51cc7..b9f54cee629c 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -224,6 +224,18 @@ pref("general.autoScroll", true); #endif pref("general.useragent.complexOverride.moodle", true); // bug 797703 +pref("general.useragent.override.bank.barclays.co.uk", "Gecko/[^ ]*#Gecko/20100101"); // bug 804169 +pref("general.useragent.override.bankmillennium.pl", "Gecko/[^ ]*#Gecko/20100101"); // bug 804103 +pref("general.useragent.override.becu.org", "Gecko/[^ ]*#Gecko/20100101"); // bug 804170 +pref("general.useragent.override.becuonlinebanking.org", "Gecko/[^ ]*#Gecko/20100101"); // bug 804170 +pref("general.useragent.override.bfsfcu.org", "Gecko/[^ ]*#Gecko/20100101"); // bug 804171 +pref("general.useragent.override.cenfedcu.org", "Gecko/[^ ]*#Gecko/20100101"); // bug 804172 +pref("general.useragent.override.coastal24.com", "Gecko/[^ ]*#Gecko/20100101"); // bug 804175 +pref("general.useragent.override.mtb.com", "Gecko/[^ ]*#Gecko/20100101"); // bug 795350 +pref("general.useragent.override.mandtbank.com", "Gecko/[^ ]*#Gecko/20100101"); // bug 795350 +pref("general.useragent.override.natweststockbrokers.co.uk", "Gecko/[^ ]*#Gecko/20100101"); // bug 804179 +pref("general.useragent.override.natweststockbrokers.com", "Gecko/[^ ]*#Gecko/20100101"); // bug 804179 +pref("general.useragent.override.raiffeisen.hu", "Gecko/[^ ]*#Gecko/20100101"); // bug 795348 // At startup, check if we're the default browser and prompt user if not. pref("browser.shell.checkDefaultBrowser", true); diff --git a/browser/components/privatebrowsing/test/browser/obsolete/browser_console_clear.js b/browser/components/privatebrowsing/test/browser/obsolete/browser_console_clear.js index 5b60b73c2b5a..a4953395e343 100644 --- a/browser/components/privatebrowsing/test/browser/obsolete/browser_console_clear.js +++ b/browser/components/privatebrowsing/test/browser/obsolete/browser_console_clear.js @@ -35,9 +35,7 @@ function test() { consoleService.registerListener(consoleObserver); function messageExists() { - let out = {}; - consoleService.getMessageArray(out, {}); - let messages = out.value || []; + let messages = consoleService.getMessageArray() || []; for (let i = 0; i < messages.length; ++i) { if (messages[i].message == TEST_MESSAGE) return true; diff --git a/build/mobile/b2gautomation.py b/build/mobile/b2gautomation.py index ce1298a4076d..9288476fcf89 100644 --- a/build/mobile/b2gautomation.py +++ b/build/mobile/b2gautomation.py @@ -48,6 +48,7 @@ class B2GRemoteAutomation(Automation): # Default our product to b2g self._product = "b2g" + self.lastTestSeen = "b2gautomation.py" # Default log finish to mochitest standard self.logFinish = 'INFO SimpleTest FINISHED' Automation.__init__(self) @@ -131,19 +132,22 @@ class B2GRemoteAutomation(Automation): output. """ timeout = timeout or 120 - - didTimeout = False - - done = time.time() + timeout + responseDueBy = time.time() + timeout while True: currentlog = proc.stdout if currentlog: - done = time.time() + timeout + responseDueBy = time.time() + timeout print currentlog + # Match the test filepath from the last TEST-START line found in the new + # log content. These lines are in the form: + # ... INFO TEST-START | /filepath/we/wish/to/capture.html\n + testStartFilenames = re.findall(r"TEST-START \| ([^\s]*)", currentlog) + if testStartFilenames: + self.lastTestSeen = testStartFilenames[-1] if hasattr(self, 'logFinish') and self.logFinish in currentlog: return 0 else: - if time.time() > done: + if time.time() > responseDueBy: self.log.info("TEST-UNEXPECTED-FAIL | %s | application timed " "out after %d seconds with no output", self.lastTestSeen, int(timeout)) @@ -341,4 +345,3 @@ class B2GRemoteAutomation(Automation): def kill(self): # this should never happen raise Exception("'kill' called on B2GInstance") - diff --git a/configure.in b/configure.in index ccbd2ca3febd..a1d48cb3d92d 100644 --- a/configure.in +++ b/configure.in @@ -2146,7 +2146,7 @@ ia64*-hpux*) # Use temp file for windres (bug 213281) RCFLAGS='-O coff --use-temp-file' # mingw doesn't require kernel32, user32, and advapi32 explicitly - LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv" + LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32" MOZ_FIX_LINK_PATHS= DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc' XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc' @@ -2202,7 +2202,7 @@ ia64*-hpux*) # make 'foo == bar;' error out CFLAGS="$CFLAGS -we4553" CXXFLAGS="$CXXFLAGS -we4553" - LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib" + LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib" MOZ_DEBUG_FLAGS='-Zi' MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV' WARNINGS_AS_ERRORS='-WX' diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 4b67a9db187f..761d0ed1011c 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -2760,7 +2760,6 @@ nsContentUtils::LoadImage(nsIURI* aURI, nsIDocument* aLoadingDocument, aLoadingDocument, /* uniquification key */ aLoadFlags, /* load flags */ nullptr, /* cache key */ - nullptr, /* existing request*/ channelPolicy, /* CSP info */ aRequest); } diff --git a/content/html/content/src/nsTextEditorState.cpp b/content/html/content/src/nsTextEditorState.cpp index b2afb2e63a3a..3283f4eacd2e 100644 --- a/content/html/content/src/nsTextEditorState.cpp +++ b/content/html/content/src/nsTextEditorState.cpp @@ -1198,7 +1198,7 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue) preDestroyer.Init(newEditor); // Make sure we clear out the non-breaking space before we initialize the editor - rv = mBoundFrame->UpdateValueDisplay(false, true); + rv = mBoundFrame->UpdateValueDisplay(true, true); NS_ENSURE_SUCCESS(rv, rv); } else { if (aValue || !mEditorInitialized) { diff --git a/content/xul/templates/tests/chrome/templates_shared.js b/content/xul/templates/tests/chrome/templates_shared.js index 267f11780146..c46612c7a556 100644 --- a/content/xul/templates/tests/chrome/templates_shared.js +++ b/content/xul/templates/tests/chrome/templates_shared.js @@ -434,9 +434,8 @@ function compareConsoleMessages() { var consoleService = Components.classes["@mozilla.org/consoleservice;1"]. getService(Components.interfaces.nsIConsoleService); - var out = {}; - consoleService.getMessageArray(out, {}); - var messages = (out.value || []).map(function (m) m.message); + var messages = consoleService.getMessageArray() || []; + messages = messages.map(function (m) m.message); // Copy to avoid modifying expectedConsoleMessages var expect = expectedConsoleMessages.concat(); for (var m = 0; m < messages.length; m++) { diff --git a/content/xul/templates/tests/chrome/test_tmpl_errors.xul b/content/xul/templates/tests/chrome/test_tmpl_errors.xul index 704dcc8fb956..e6852210fbdc 100644 --- a/content/xul/templates/tests/chrome/test_tmpl_errors.xul +++ b/content/xul/templates/tests/chrome/test_tmpl_errors.xul @@ -23,9 +23,8 @@ var consoleService = Components.classes["@mozilla.org/consoleservice;1"]. function checkConsole(expectedError) { - var out = {}; - consoleService.getMessageArray(out, {}); - is(out.value[0].message, expectedError, "logged message " + expectedError); + var message = consoleService.getMessageArray()[0].message; + is(message, expectedError, "logged message " + expectedError); } // each test consists of a pre function executed before the template build, an diff --git a/dom/ipc/AppProcessPermissions.cpp b/dom/ipc/AppProcessPermissions.cpp index 9326179a3ae6..1a8672a77c2e 100644 --- a/dom/ipc/AppProcessPermissions.cpp +++ b/dom/ipc/AppProcessPermissions.cpp @@ -41,6 +41,10 @@ AssertAppProcessPermission(PBrowserParent* aActor, const char* aPermission) if (!hasPermission) { printf_stderr("Security problem: Content process does not have `%s' permission. It will be killed.\n", aPermission); + if (!strcmp(aPermission, "indexedDB-chrome-settings-read") || !strcmp(aPermission, "indexedDB-chrome-settings-write")) { + printf_stderr("XXX FIXXME BUG 808327: We ignore indexedDB-chrome-settings-* for now."); + return true; + } ContentParent* process = static_cast(aActor->Manager()); process->KillHard(); } diff --git a/embedding/browser/webBrowser/nsContextMenuInfo.cpp b/embedding/browser/webBrowser/nsContextMenuInfo.cpp index 492faa474fc9..b923174246db 100644 --- a/embedding/browser/webBrowser/nsContextMenuInfo.cpp +++ b/embedding/browser/webBrowser/nsContextMenuInfo.cpp @@ -305,7 +305,7 @@ nsContextMenuInfo::GetBackgroundImageRequestInternal(nsIDOMNode *aDOMNode, imgIR NS_ENSURE_TRUE(il, NS_ERROR_FAILURE); return il->LoadImage(bgUri, nullptr, nullptr, principal, nullptr, - nullptr, nullptr, nsIRequest::LOAD_NORMAL, nullptr, + nullptr, nullptr, nsIRequest::LOAD_NORMAL, nullptr, channelPolicy, aRequest); } } diff --git a/image/public/imgILoader.idl b/image/public/imgILoader.idl index 9018fe5d89c0..a3e973d25362 100644 --- a/image/public/imgILoader.idl +++ b/image/public/imgILoader.idl @@ -27,7 +27,7 @@ interface nsIChannelPolicy; * @version 0.3 * @see imagelib2 */ -[scriptable, uuid(f5a7c016-8caf-460a-b1a1-3fe5534d5c9e)] +[scriptable, uuid(278c4c8e-934f-4364-b49b-081cd8b1d595)] interface imgILoader : nsISupports { // Extra flags to pass to loadImage if you want a load to use CORS @@ -47,8 +47,6 @@ interface imgILoader : nsISupports * @param aLoadFlags Load flags for the request * @param aCacheKey cache key to use for a load if the original * image came from a request that had post data - * @param aRequest A newly created, unused imgIRequest object or NULL for one to - be created for you. * libpr0n does NOT keep a strong ref to the observer; this prevents @@ -65,7 +63,6 @@ interface imgILoader : nsISupports in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports cacheKey, - in imgIRequest aRequest, in nsIChannelPolicy channelPolicy); /** diff --git a/image/src/imgLoader.cpp b/image/src/imgLoader.cpp index ff43b918cf54..b50612d5a26a 100644 --- a/image/src/imgLoader.cpp +++ b/image/src/imgLoader.cpp @@ -681,8 +681,7 @@ imgCacheQueue::const_iterator imgCacheQueue::end() const nsresult imgLoader::CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup *aLoadGroup, imgINotificationObserver *aObserver, - nsLoadFlags aLoadFlags, imgIRequest *aProxyRequest, - imgIRequest **_retval) + nsLoadFlags aLoadFlags, imgIRequest **_retval) { LOG_SCOPE_WITH_PARAM(GetImgLog(), "imgLoader::CreateNewProxyForRequest", "imgRequest", aRequest); @@ -691,12 +690,7 @@ nsresult imgLoader::CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup proxy calls to |aObserver|. */ - imgRequestProxy *proxyRequest; - if (aProxyRequest) { - proxyRequest = static_cast(aProxyRequest); - } else { - proxyRequest = new imgRequestProxy(); - } + imgRequestProxy *proxyRequest = new imgRequestProxy(); NS_ADDREF(proxyRequest); /* It is important to call |SetLoadFlags()| before calling |Init()| because @@ -1165,7 +1159,6 @@ bool imgLoader::ValidateRequestWithNewChannel(imgRequest *request, imgINotificationObserver *aObserver, nsISupports *aCX, nsLoadFlags aLoadFlags, - imgIRequest *aExistingRequest, imgIRequest **aProxyRequest, nsIChannelPolicy *aPolicy, nsIPrincipal* aLoadingPrincipal, @@ -1180,8 +1173,7 @@ bool imgLoader::ValidateRequestWithNewChannel(imgRequest *request, // If we're currently in the middle of validating this request, just hand // back a proxy to it; the required work will be done for us. if (request->mValidator) { - rv = CreateNewProxyForRequest(request, aLoadGroup, aObserver, - aLoadFlags, aExistingRequest, + rv = CreateNewProxyForRequest(request, aLoadGroup, aObserver, aLoadFlags, reinterpret_cast(aProxyRequest)); if (NS_FAILED(rv)) { return false; @@ -1224,7 +1216,7 @@ bool imgLoader::ValidateRequestWithNewChannel(imgRequest *request, nsCOMPtr req; rv = CreateNewProxyForRequest(request, aLoadGroup, aObserver, - aLoadFlags, aExistingRequest, getter_AddRefs(req)); + aLoadFlags, getter_AddRefs(req)); if (NS_FAILED(rv)) { return false; } @@ -1288,7 +1280,6 @@ bool imgLoader::ValidateEntry(imgCacheEntry *aEntry, nsISupports *aCX, nsLoadFlags aLoadFlags, bool aCanMakeNewChannel, - imgIRequest *aExistingRequest, imgIRequest **aProxyRequest, nsIChannelPolicy *aPolicy, nsIPrincipal* aLoadingPrincipal, @@ -1389,8 +1380,7 @@ bool imgLoader::ValidateEntry(imgCacheEntry *aEntry, return ValidateRequestWithNewChannel(request, aURI, aInitialDocumentURI, aReferrerURI, aLoadGroup, aObserver, - aCX, aLoadFlags, aExistingRequest, - aProxyRequest, aPolicy, + aCX, aLoadFlags, aProxyRequest, aPolicy, aLoadingPrincipal, aCORSMode); } @@ -1521,7 +1511,7 @@ nsresult imgLoader::EvictEntries(imgCacheQueue &aQueueToClear) nsIRequest::VALIDATE_ONCE_PER_SESSION) -/* imgIRequest loadImage (in nsIURI aURI, in nsIURI initialDocumentURI, in nsIPrincipal loadingPrincipal, in nsILoadGroup aLoadGroup, in imgINotificationObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports cacheKey, in imgIRequest aRequest); */ +/* imgIRequest loadImage(in nsIURI aURI, in nsIURI aInitialDocumentURL, in nsIURI aReferrerURI, in nsIPrincipal aLoadingPrincipal, in nsILoadGroup aLoadGroup, in imgINotificationObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports cacheKey, in nsIChannelPolicy channelPolicy); */ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsIURI *aInitialDocumentURI, @@ -1532,7 +1522,6 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, nsISupports *aCX, nsLoadFlags aLoadFlags, nsISupports *aCacheKey, - imgIRequest *aRequest, nsIChannelPolicy *aPolicy, imgIRequest **_retval) { @@ -1557,10 +1546,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, #ifdef DEBUG bool isPrivate = false; - nsCOMPtr channel = do_QueryInterface(aRequest); - if (channel) { - isPrivate = NS_UsePrivateBrowsing(channel); - } else if (aLoadGroup) { + if (aLoadGroup) { nsCOMPtr callbacks; aLoadGroup->GetNotificationCallbacks(getter_AddRefs(callbacks)); if (callbacks) { @@ -1615,7 +1601,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, if (cache.Get(spec, getter_AddRefs(entry)) && entry) { if (ValidateEntry(entry, aURI, aInitialDocumentURI, aReferrerURI, aLoadGroup, aObserver, aCX, requestFlags, true, - aRequest, _retval, aPolicy, aLoadingPrincipal, corsmode)) { + _retval, aPolicy, aLoadingPrincipal, corsmode)) { request = getter_AddRefs(entry->GetRequest()); // If this entry has no proxies, its request has no reference to the entry. @@ -1746,7 +1732,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, LOG_MSG(GetImgLog(), "imgLoader::LoadImage", "creating proxy request."); rv = CreateNewProxyForRequest(request, aLoadGroup, aObserver, - requestFlags, aRequest, _retval); + requestFlags, _retval); if (NS_FAILED(rv)) { return rv; } @@ -1823,7 +1809,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgINotificat // code, but seems nonsensical. if (ValidateEntry(entry, uri, nullptr, nullptr, nullptr, aObserver, aCX, requestFlags, false, nullptr, nullptr, nullptr, - nullptr, imgIRequest::CORS_NONE)) { + imgIRequest::CORS_NONE)) { request = getter_AddRefs(entry->GetRequest()); } else { nsCOMPtr cacheChan(do_QueryInterface(channel)); @@ -1870,7 +1856,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgINotificat *listener = nullptr; // give them back a null nsIStreamListener rv = CreateNewProxyForRequest(request, loadGroup, aObserver, - requestFlags, nullptr, _retval); + requestFlags, _retval); static_cast(*_retval)->NotifyListener(); } else { // Default to doing a principal check because we don't know who @@ -1898,7 +1884,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgINotificat PutIntoCache(originalURI, entry); rv = CreateNewProxyForRequest(request, loadGroup, aObserver, - requestFlags, nullptr, _retval); + requestFlags, _retval); // Explicitly don't notify our proxy, because we're loading off the // network, and necko (or things called from necko, such as diff --git a/image/src/imgLoader.h b/image/src/imgLoader.h index 318b7c0d3d5d..12c26ed66521 100644 --- a/image/src/imgLoader.h +++ b/image/src/imgLoader.h @@ -285,24 +285,22 @@ public: private: // methods - bool ValidateEntry(imgCacheEntry *aEntry, nsIURI *aKey, nsIURI *aInitialDocumentURI, nsIURI *aReferrerURI, nsILoadGroup *aLoadGroup, imgINotificationObserver *aObserver, nsISupports *aCX, nsLoadFlags aLoadFlags, bool aCanMakeNewChannel, - imgIRequest *aExistingRequest, imgIRequest **aProxyRequest, nsIChannelPolicy *aPolicy, nsIPrincipal* aLoadingPrincipal, int32_t aCORSMode); + bool ValidateRequestWithNewChannel(imgRequest *request, nsIURI *aURI, nsIURI *aInitialDocumentURI, nsIURI *aReferrerURI, nsILoadGroup *aLoadGroup, imgINotificationObserver *aObserver, nsISupports *aCX, nsLoadFlags aLoadFlags, - imgIRequest *aExistingRequest, imgIRequest **aProxyRequest, nsIChannelPolicy *aPolicy, nsIPrincipal* aLoadingPrincipal, @@ -310,8 +308,7 @@ private: // methods nsresult CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup *aLoadGroup, imgINotificationObserver *aObserver, - nsLoadFlags aLoadFlags, imgIRequest *aRequestProxy, - imgIRequest **_retval); + nsLoadFlags aLoadFlags, imgIRequest **_retval); void ReadAcceptHeaderPref(); diff --git a/image/test/unit/async_load_tests.js b/image/test/unit/async_load_tests.js index 9f024141cac3..bbb77a0a4a81 100644 --- a/image/test/unit/async_load_tests.js +++ b/image/test/unit/async_load_tests.js @@ -96,7 +96,7 @@ function checkSecondLoad() var listener = new ImageListener(checkClone, secondLoadDone); var outer = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools) .createScriptedObserver(listener); - requests.push(gCurrentLoader.loadImage(uri, null, null, null, null, outer, null, 0, null, null, null)); + requests.push(gCurrentLoader.loadImage(uri, null, null, null, null, outer, null, 0, null, null)); listener.synchronous = false; } @@ -198,7 +198,7 @@ function startImageCallback(otherCb) var listener2 = new ImageListener(null, function(foo, bar) { do_test_finished(); }); var outer = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools) .createScriptedObserver(listener2); - requests.push(gCurrentLoader.loadImage(uri, null, null, null, null, outer, null, 0, null, null, null)); + requests.push(gCurrentLoader.loadImage(uri, null, null, null, null, outer, null, 0, null, null)); listener2.synchronous = false; // Now that we've started another load, chain to the callback. @@ -216,7 +216,7 @@ function run_test() var listener = new ImageListener(startImageCallback(checkClone), firstLoadDone); var outer = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools) .createScriptedObserver(listener); - var req = gCurrentLoader.loadImage(uri, null, null, null, null, outer, null, 0, null, null, null); + var req = gCurrentLoader.loadImage(uri, null, null, null, null, outer, null, 0, null, null); requests.push(req); // Ensure that we don't cause any mayhem when we lock an image. diff --git a/image/test/unit/test_private_channel.js b/image/test/unit/test_private_channel.js index 6682f3ce3a59..9086aad7312b 100644 --- a/image/test/unit/test_private_channel.js +++ b/image/test/unit/test_private_channel.js @@ -73,7 +73,7 @@ function loadImage(isPrivate, callback) { var loadGroup = Cc["@mozilla.org/network/load-group;1"].createInstance(Ci.nsILoadGroup); loadGroup.notificationCallbacks = new NotificationCallbacks(isPrivate); var loader = isPrivate ? gPrivateLoader : gPublicLoader; - requests.push(loader.loadImage(uri, null, null, null, loadGroup, outer, null, 0, null, null, null)); + requests.push(loader.loadImage(uri, null, null, null, loadGroup, outer, null, 0, null, null)); listener.synchronous = false; } @@ -112,4 +112,4 @@ function run_test() { }); }); }); -} \ No newline at end of file +} diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index e7f8547d725e..747100fd29cd 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1837,7 +1837,6 @@ nsImageFrame::LoadIcon(const nsAString& aSpec, nullptr, /* Not associated with any particular document */ loadFlags, nullptr, - nullptr, nullptr, /* channel policy not needed */ aRequest); } diff --git a/mobile/xul/chrome/content/console.js b/mobile/xul/chrome/content/console.js index e6f1ad99ea36..af4cd1c9d3a4 100644 --- a/mobile/xul/chrome/content/console.js +++ b/mobile/xul/chrome/content/console.js @@ -192,9 +192,7 @@ let ConsoleView = { }, appendInitialItems: function cv_appendInitialItems() { - let out = {}; // Throwaway references to support 'out' parameters. - Services.console.getMessageArray(out, {}); - let messages = out.value; + let messages = Services.console.getMessageArray(); // In case getMessageArray returns 0-length array as null if (!messages) diff --git a/netwerk/base/public/nsNetUtil.h b/netwerk/base/public/nsNetUtil.h index d4f8ad364302..8df13000864b 100644 --- a/netwerk/base/public/nsNetUtil.h +++ b/netwerk/base/public/nsNetUtil.h @@ -2006,9 +2006,7 @@ NS_GetContentDispositionFromToken(const nsAString& aDispToken) // Broken sites just send // Content-Disposition: filename="file" // without a disposition token... screen those out. - StringHead(aDispToken, 8).LowerCaseEqualsLiteral("filename") || - // Also in use is Content-Disposition: name="file" - StringHead(aDispToken, 4).LowerCaseEqualsLiteral("name")) + StringHead(aDispToken, 8).LowerCaseEqualsLiteral("filename")) return nsIChannel::DISPOSITION_INLINE; return nsIChannel::DISPOSITION_ATTACHMENT; @@ -2077,11 +2075,6 @@ NS_GetFilenameFromDisposition(nsAString& aFilename, rv = mimehdrpar->GetParameter(aDisposition, "filename", fallbackCharset, true, nullptr, aFilename); - if (NS_FAILED(rv) || aFilename.IsEmpty()) { - // Try 'name' parameter, instead. - rv = mimehdrpar->GetParameter(aDisposition, "name", fallbackCharset, - true, nullptr, aFilename); - } if (NS_FAILED(rv)) { aFilename.Truncate(); diff --git a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp index 81665bbbac10..89523f8bde81 100644 --- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp +++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp @@ -1681,15 +1681,19 @@ nsFtpState::Init(nsFtpChannel *channel) mAction = PUT; nsresult rv; - nsAutoCString path; nsCOMPtr url = do_QueryInterface(mChannel->URI()); - - nsCString host; - url->GetAsciiHost(host); - if (host.IsEmpty()) { + + nsAutoCString host; + if (url) { + rv = url->GetAsciiHost(host); + } else { + rv = mChannel->URI()->GetAsciiHost(host); + } + if (NS_FAILED(rv) || host.IsEmpty()) { return NS_ERROR_MALFORMED_URI; } - + + nsAutoCString path; if (url) { rv = url->GetFilePath(path); } else { diff --git a/toolkit/components/console/content/consoleBindings.xml b/toolkit/components/console/content/consoleBindings.xml index 5eb44e0977f1..3d30af416ec8 100644 --- a/toolkit/components/console/content/consoleBindings.xml +++ b/toolkit/components/console/content/consoleBindings.xml @@ -130,9 +130,7 @@ diff --git a/toolkit/components/startup/nsUserInfoWin.cpp b/toolkit/components/startup/nsUserInfoWin.cpp index 9fde3aafb1b2..4e601e76f8ee 100644 --- a/toolkit/components/startup/nsUserInfoWin.cpp +++ b/toolkit/components/startup/nsUserInfoWin.cpp @@ -9,6 +9,10 @@ #include "nsCRT.h" #include "nsXPIDLString.h" +#define SECURITY_WIN32 +#include "lm.h" +#include "security.h" + nsUserInfo::nsUserInfo() { } @@ -17,41 +21,111 @@ nsUserInfo::~nsUserInfo() { } -NS_IMPL_ISUPPORTS1(nsUserInfo,nsIUserInfo) +NS_IMPL_ISUPPORTS1(nsUserInfo, nsIUserInfo) NS_IMETHODIMP nsUserInfo::GetUsername(char **aUsername) { - *aUsername = nullptr; + NS_ENSURE_ARG_POINTER(aUsername); + *aUsername = nullptr; - PRUnichar username[256]; - DWORD size = 256; + // ULEN is the max username length as defined in lmcons.h + PRUnichar username[UNLEN +1]; + DWORD size = mozilla::ArrayLength(username); + if (!GetUserNameW(username, &size)) + return NS_ERROR_FAILURE; - if (!GetUserNameW(username, &size)) - return NS_ERROR_FAILURE; - - *aUsername = ToNewUTF8String(nsDependentString(username)); - - return (*aUsername) ? NS_OK : NS_ERROR_FAILURE; + *aUsername = ToNewUTF8String(nsDependentString(username)); + return (*aUsername) ? NS_OK : NS_ERROR_FAILURE; } -NS_IMETHODIMP +NS_IMETHODIMP nsUserInfo::GetFullname(PRUnichar **aFullname) { - *aFullname = nullptr; - return NS_ERROR_NOT_IMPLEMENTED; + NS_ENSURE_ARG_POINTER(aFullname); + *aFullname = nullptr; + + PRUnichar fullName[512]; + DWORD size = mozilla::ArrayLength(fullName); + + if (GetUserNameExW(NameDisplay, fullName, &size)) { + *aFullname = ToNewUnicode(nsDependentString(fullName)); + } else { + DWORD getUsernameError = GetLastError(); + + // Try to use the net APIs regardless of the error because it may be + // able to obtain the information. + PRUnichar username[UNLEN + 1]; + size = mozilla::ArrayLength(username); + if (!GetUserNameW(username, &size)) { + // ERROR_NONE_MAPPED means the user info is not filled out on this computer + return getUsernameError == ERROR_NONE_MAPPED ? + NS_ERROR_NOT_AVAILABLE : NS_ERROR_FAILURE; + } + + const DWORD level = 2; + LPBYTE info; + // If the NetUserGetInfo function has no full name info it will return + // success with an empty string. + NET_API_STATUS status = NetUserGetInfo(nullptr, username, level, &info); + if (status != NERR_Success) { + // We have an error with NetUserGetInfo but we know the info is not + // filled in because GetUserNameExW returned ERROR_NONE_MAPPED. + return getUsernameError == ERROR_NONE_MAPPED ? + NS_ERROR_NOT_AVAILABLE : NS_ERROR_FAILURE; + } + + nsDependentString fullName = + nsDependentString(reinterpret_cast(info)->usri2_full_name); + + // NetUserGetInfo returns an empty string if the full name is not filled out + if (fullName.Length() == 0) { + NetApiBufferFree(info); + return NS_ERROR_NOT_AVAILABLE; + } + + *aFullname = ToNewUnicode(fullName); + NetApiBufferFree(info); + } + + return (*aFullname) ? NS_OK : NS_ERROR_FAILURE; } -NS_IMETHODIMP -nsUserInfo::GetDomain(char * *aDomain) -{ - *aDomain = nullptr; - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsUserInfo::GetEmailAddress(char * *aEmailAddress) +NS_IMETHODIMP +nsUserInfo::GetDomain(char **aDomain) { - *aEmailAddress = nullptr; - return NS_ERROR_NOT_IMPLEMENTED; + NS_ENSURE_ARG_POINTER(aDomain); + *aDomain = nullptr; + + const DWORD level = 100; + LPBYTE info; + NET_API_STATUS status = NetWkstaGetInfo(NULL, level, &info); + if (status == NERR_Success) { + *aDomain = + ToNewUTF8String(nsDependentString(reinterpret_cast(info)-> + wki100_langroup)); + NetApiBufferFree(info); + } + + return (*aDomain) ? NS_OK : NS_ERROR_FAILURE; +} + +NS_IMETHODIMP +nsUserInfo::GetEmailAddress(char **aEmailAddress) +{ + NS_ENSURE_ARG_POINTER(aEmailAddress); + *aEmailAddress = nullptr; + + // RFC3696 says max length of an email address is 254 + PRUnichar emailAddress[255]; + DWORD size = mozilla::ArrayLength(emailAddress); + + if (!GetUserNameExW(NameUserPrincipal, emailAddress, &size)) { + DWORD getUsernameError = GetLastError(); + return getUsernameError == ERROR_NONE_MAPPED ? + NS_ERROR_NOT_AVAILABLE : NS_ERROR_FAILURE; + } + + *aEmailAddress = ToNewUTF8String(nsDependentString(emailAddress)); + return (*aEmailAddress) ? NS_OK : NS_ERROR_FAILURE; } diff --git a/toolkit/devtools/webconsole/WebConsoleUtils.jsm b/toolkit/devtools/webconsole/WebConsoleUtils.jsm index b4abc490a4a2..2a4e40005945 100644 --- a/toolkit/devtools/webconsole/WebConsoleUtils.jsm +++ b/toolkit/devtools/webconsole/WebConsoleUtils.jsm @@ -1326,22 +1326,14 @@ PageErrorListener.prototype = { let innerWindowId = this.window ? WebConsoleUtils.getInnerWindowId(this.window) : null; - let result = []; - let errors = {}; - Services.console.getMessageArray(errors, {}); + let errors = Services.console.getMessageArray() || []; - (errors.value || []).forEach(function(aError) { - if (!(aError instanceof Ci.nsIScriptError) || - (innerWindowId && - (aError.innerWindowID != innerWindowId || - !this.isCategoryAllowed(aError.category)))) { - return; - } - - result.push(aError); + return errors.filter(function(aError) { + return aError instanceof Ci.nsIScriptError && + (!innerWindowId || + (aError.innerWindowID == innerWindowId && + this.isCategoryAllowed(aError.category))); }, this); - - return result; }, /** diff --git a/toolkit/devtools/webconsole/test/test_cached_messages.html b/toolkit/devtools/webconsole/test/test_cached_messages.html index 594feda99da2..ef3930db716e 100644 --- a/toolkit/devtools/webconsole/test/test_cached_messages.html +++ b/toolkit/devtools/webconsole/test/test_cached_messages.html @@ -44,16 +44,17 @@ function doPageErrors() }, ]; - let body = top.document.documentElement; - let container = top.document.createElementNS(XHTML_NS, "script"); - body.appendChild(container); - container.textContent = "document.documentElement.style.color = 'fooColor';"; - body.removeChild(container); + let container = document.createElement("script"); + document.body.appendChild(container); + container.textContent = "document.body.style.color = 'fooColor';"; + document.body.removeChild(container); - container = top.document.createElementNS(XHTML_NS, "script"); - body.appendChild(container); + SimpleTest.expectUncaughtException(); + + container = document.createElement("script"); + document.body.appendChild(container); container.textContent = "document.doTheImpossible();"; - body.removeChild(container); + document.body.removeChild(container); } function doConsoleCalls() diff --git a/toolkit/system/gnome/nsAlertsIconListener.cpp b/toolkit/system/gnome/nsAlertsIconListener.cpp index f53d659b3aca..9cb6b9df2ec0 100644 --- a/toolkit/system/gnome/nsAlertsIconListener.cpp +++ b/toolkit/system/gnome/nsAlertsIconListener.cpp @@ -202,7 +202,7 @@ nsAlertsIconListener::StartRequest(const nsAString & aImageUrl) return il->LoadImage(imageUri, nullptr, nullptr, nullptr, nullptr, this, nullptr, nsIRequest::LOAD_NORMAL, nullptr, nullptr, - nullptr, getter_AddRefs(mIconRequest)); + getter_AddRefs(mIconRequest)); } void diff --git a/toolkit/xre/nsConsoleWriter.cpp b/toolkit/xre/nsConsoleWriter.cpp index 89fc5a192e94..b747dcd6952f 100644 --- a/toolkit/xre/nsConsoleWriter.cpp +++ b/toolkit/xre/nsConsoleWriter.cpp @@ -58,7 +58,7 @@ WriteConsoleLog() nsIConsoleMessage** messages; uint32_t mcount; - rv = csrv->GetMessageArray(&messages, &mcount); + rv = csrv->GetMessageArray(&mcount, &messages); if (NS_FAILED(rv)) { PR_Close(file); return; diff --git a/uriloader/prefetch/OfflineCacheUpdateChild.cpp b/uriloader/prefetch/OfflineCacheUpdateChild.cpp index bbfc69e3f5c9..a08d38bf4843 100644 --- a/uriloader/prefetch/OfflineCacheUpdateChild.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateChild.cpp @@ -82,8 +82,8 @@ OfflineCacheUpdateChild::OfflineCacheUpdateChild(nsIDOMWindow* aWindow) : mState(STATE_UNINITIALIZED) , mIsUpgrade(false) , mIPCActivated(false) - , mInBrowser(false) , mAppID(NECKO_NO_APP_ID) + , mInBrowser(false) , mWindow(aWindow) , mByteProgress(0) { diff --git a/uriloader/prefetch/nsOfflineCacheUpdate.cpp b/uriloader/prefetch/nsOfflineCacheUpdate.cpp index a79cc60f6525..ad3473f1d71f 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp @@ -38,6 +38,7 @@ #include "nsStreamUtils.h" #include "nsThreadUtils.h" #include "nsProxyRelease.h" +#include "nsIConsoleService.h" #include "prlog.h" #include "nsIAsyncVerifyRedirectCallback.h" #include "mozilla/Preferences.h" @@ -81,7 +82,9 @@ private: char **mValues; }; -static nsresult +namespace { // anon + +nsresult DropReferenceFromURL(nsIURI * aURI) { // XXXdholbert If this SetRef fails, callers of this method probably @@ -89,6 +92,27 @@ DropReferenceFromURL(nsIURI * aURI) return aURI->SetRef(EmptyCString()); } +void +LogToConsole(const char * message, nsOfflineCacheUpdateItem * item = nullptr) +{ + nsCOMPtr consoleService = + do_GetService(NS_CONSOLESERVICE_CONTRACTID); + if (consoleService) + { + nsAutoString messageUTF16 = NS_ConvertUTF8toUTF16(message); + if (item && item->mURI) { + nsAutoCString uriSpec; + item->mURI->GetSpec(uriSpec); + + messageUTF16.Append(NS_LITERAL_STRING(", URL=")); + messageUTF16.Append(NS_ConvertUTF8toUTF16(uriSpec)); + } + consoleService->LogStringMessage(messageUTF16.get()); + } +} + +} // anon namespace + //----------------------------------------------------------------------------- // nsManifestCheck //----------------------------------------------------------------------------- @@ -270,6 +294,9 @@ nsManifestCheck::AsyncOnChannelRedirect(nsIChannel *aOldChannel, callback->OnRedirectVerifyCallback(NS_OK); return NS_OK; } + + LogToConsole("Manifest check failed because its response is a redirect"); + aOldChannel->Cancel(NS_ERROR_ABORT); return NS_ERROR_ABORT; } @@ -432,7 +459,14 @@ nsOfflineCacheUpdateItem::OnStopRequest(nsIRequest *aRequest, nsISupports *aContext, nsresult aStatus) { - LOG(("done fetching offline item [status=%x]\n", aStatus)); +#if defined(PR_LOGGING) + if (LOG_ENABLED()) { + nsAutoCString spec; + mURI->GetSpec(spec); + LOG(("%p: Done fetching offline item %s [status=%x]\n", + this, spec.get(), aStatus)); + } +#endif if (mBytesRead == 0 && aStatus == NS_OK) { // we didn't need to read (because LOAD_ONLY_IF_MODIFIED was @@ -500,6 +534,8 @@ nsOfflineCacheUpdateItem::AsyncOnChannelRedirect(nsIChannel *aOldChannel, if (!(aFlags & nsIChannelEventSink::REDIRECT_INTERNAL)) { // Don't allow redirect in case of non-internal redirect and cancel // the channel to clean the cache entry. + LogToConsole("Offline cache manifest failed because an item redirects", this); + aOldChannel->Cancel(NS_ERROR_ABORT); return NS_ERROR_ABORT; } @@ -815,6 +851,7 @@ nsOfflineManifestItem::HandleManifestLine(const nsCString::const_iterator &aBegi if (++begin == end || static_cast(*begin) != 0xbb || ++begin == end || static_cast(*begin) != 0xbf) { mParserState = PARSE_ERROR; + LogToConsole("Offline cache manifest BOM error", this); return NS_OK; } ++begin; @@ -824,6 +861,7 @@ nsOfflineManifestItem::HandleManifestLine(const nsCString::const_iterator &aBegi if (!magic.EqualsLiteral("CACHE MANIFEST")) { mParserState = PARSE_ERROR; + LogToConsole("Offline cache manifest magic incorect", this); return NS_OK; } @@ -1080,6 +1118,7 @@ nsOfflineManifestItem::OnStartRequest(nsIRequest *aRequest, if (!succeeded) { LOG(("HTTP request failed")); + LogToConsole("Offline cache manifest HTTP request failed", this); mParserState = PARSE_ERROR; return NS_ERROR_ABORT; } @@ -1091,6 +1130,7 @@ nsOfflineManifestItem::OnStartRequest(nsIRequest *aRequest, if (!contentType.EqualsLiteral("text/cache-manifest")) { LOG(("Rejected cache manifest with Content-Type %s (expecting text/cache-manifest)", contentType.get())); + LogToConsole("Offline cache manifest not served with text/cache-manifest", this); mParserState = PARSE_ERROR; return NS_ERROR_ABORT; } @@ -1534,6 +1574,7 @@ nsOfflineCacheUpdate::LoadCompleted(nsOfflineCacheUpdateItem *aItem) uint16_t status; rv = mManifestItem->GetStatus(&status); if (status == 404 || status == 410) { + LogToConsole("Offline cache manifest removed, cache cleared", mManifestItem); mSucceeded = false; if (mPreviousApplicationCache) { if (mPinned) { @@ -1560,6 +1601,8 @@ nsOfflineCacheUpdate::LoadCompleted(nsOfflineCacheUpdateItem *aItem) } if (!doUpdate) { + LogToConsole("Offline cache doesn't need to update", mManifestItem); + mSucceeded = false; AssociateDocuments(mPreviousApplicationCache); @@ -1629,6 +1672,8 @@ nsOfflineCacheUpdate::LoadCompleted(nsOfflineCacheUpdateItem *aItem) mPinnedEntryRetriesCount++; + LogToConsole("An unpinned offline cache deleted"); + // Retry this item. ProcessNextURI(); return; @@ -1647,6 +1692,7 @@ nsOfflineCacheUpdate::LoadCompleted(nsOfflineCacheUpdateItem *aItem) if (aItem->mItemType & (nsIApplicationCache::ITEM_EXPLICIT | nsIApplicationCache::ITEM_FALLBACK)) { + LogToConsole("Offline cache manifest item failed to load", aItem); mSucceeded = false; } } else { @@ -1679,6 +1725,7 @@ nsOfflineCacheUpdate::ManifestCheckCompleted(nsresult aStatus, mManifestItem->GetManifestHash(firstManifestHash); if (aManifestHash != firstManifestHash) { LOG(("Manifest has changed during cache items download [%p]", this)); + LogToConsole("Offline cache manifest changed during update", mManifestItem); aStatus = NS_ERROR_FAILURE; } } @@ -1715,6 +1762,7 @@ nsOfflineCacheUpdate::ManifestCheckCompleted(nsresult aStatus, newUpdate->Schedule(); } else { + LogToConsole("Offline cache update done", mManifestItem); Finish(); } } @@ -1935,6 +1983,10 @@ nsOfflineCacheUpdate::NotifyState(uint32_t state) { LOG(("nsOfflineCacheUpdate::NotifyState [%p, %d]", this, state)); + if (state == STATE_ERROR) { + LogToConsole("Offline cache update error", mManifestItem); + } + nsCOMArray observers; GatherObservers(observers); diff --git a/widget/cocoa/nsMenuItemIconX.mm b/widget/cocoa/nsMenuItemIconX.mm index deee6d083d28..1db4e66eee59 100644 --- a/widget/cocoa/nsMenuItemIconX.mm +++ b/widget/cocoa/nsMenuItemIconX.mm @@ -305,7 +305,7 @@ nsMenuItemIconX::LoadIcon(nsIURI* aIconURI) // Passing in null for channelPolicy here since nsMenuItemIconX::LoadIcon is // not exposed to web content nsresult rv = loader->LoadImage(aIconURI, nullptr, nullptr, nullptr, loadGroup, this, - nullptr, nsIRequest::LOAD_NORMAL, nullptr, nullptr, + nullptr, nsIRequest::LOAD_NORMAL, nullptr, nullptr, getter_AddRefs(mIconRequest)); if (NS_FAILED(rv)) return rv; diff --git a/xpcom/base/nsConsoleService.cpp b/xpcom/base/nsConsoleService.cpp index dc868eb9219e..137cb9ef96e8 100644 --- a/xpcom/base/nsConsoleService.cpp +++ b/xpcom/base/nsConsoleService.cpp @@ -208,7 +208,7 @@ nsConsoleService::LogStringMessage(const PRUnichar *message) } NS_IMETHODIMP -nsConsoleService::GetMessageArray(nsIConsoleMessage ***messages, uint32_t *count) +nsConsoleService::GetMessageArray(uint32_t *count, nsIConsoleMessage ***messages) { nsIConsoleMessage **messageArray; diff --git a/xpcom/base/nsIConsoleService.idl b/xpcom/base/nsIConsoleService.idl index cc26eb5b6a3f..71d63a7883ba 100644 --- a/xpcom/base/nsIConsoleService.idl +++ b/xpcom/base/nsIConsoleService.idl @@ -7,7 +7,7 @@ #include "nsIConsoleListener.idl" #include "nsIConsoleMessage.idl" -[scriptable, uuid(883472a0-ea9b-11da-8ad9-0800200c9a66)] +[scriptable, uuid(0eb81d20-c37e-42d4-82a8-ca9ae96bdf52)] interface nsIConsoleService : nsISupports { void logMessage(in nsIConsoleMessage message); @@ -23,8 +23,8 @@ interface nsIConsoleService : nsISupports * will allocate one word for messages, so as to show up as a * 0-length array when called from script. */ - void getMessageArray([array, size_is(count)] out nsIConsoleMessage messages, - out uint32_t count); + void getMessageArray([optional] out uint32_t count, + [retval, array, size_is(count)] out nsIConsoleMessage messages); /** * To guard against stack overflows from listeners that could log diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index 54b19b71fc9a..980ce0a63914 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -590,43 +590,51 @@ static nsresult OpenFile(const nsAFlatString &name, int osflags, int mode, PRFileDesc **fd) { - // XXX : 'mode' is not translated !!! int32_t access = 0; - int32_t flags = 0; - int32_t flag6 = 0; - if (osflags & PR_SYNC) flag6 = FILE_FLAG_WRITE_THROUGH; - + PRInt32 disposition = 0; + PRInt32 attributes = 0; + + if (osflags & PR_SYNC) + attributes = FILE_FLAG_WRITE_THROUGH; if (osflags & PR_RDONLY || osflags & PR_RDWR) access |= GENERIC_READ; if (osflags & PR_WRONLY || osflags & PR_RDWR) access |= GENERIC_WRITE; if ( osflags & PR_CREATE_FILE && osflags & PR_EXCL ) - flags = CREATE_NEW; + disposition = CREATE_NEW; else if (osflags & PR_CREATE_FILE) { if (osflags & PR_TRUNCATE) - flags = CREATE_ALWAYS; + disposition = CREATE_ALWAYS; else - flags = OPEN_ALWAYS; + disposition = OPEN_ALWAYS; } else { if (osflags & PR_TRUNCATE) - flags = TRUNCATE_EXISTING; + disposition = TRUNCATE_EXISTING; else - flags = OPEN_EXISTING; + disposition = OPEN_EXISTING; } if (osflags & nsIFile::DELETE_ON_CLOSE) { - flag6 |= FILE_FLAG_DELETE_ON_CLOSE; + attributes |= FILE_FLAG_DELETE_ON_CLOSE; } if (osflags & nsIFile::OS_READAHEAD) { - flag6 |= FILE_FLAG_SEQUENTIAL_SCAN; + attributes |= FILE_FLAG_SEQUENTIAL_SCAN; + } + + // If no write permissions are requested, and if we are possibly creating + // the file, then set the new file as read only. + // The flag has no effect if we happen to open the file. + if (!(mode & (PR_IWUSR | PR_IWGRP | PR_IWOTH)) && + disposition != OPEN_EXISTING) { + attributes |= FILE_ATTRIBUTE_READONLY; } HANDLE file = ::CreateFileW(name.get(), access, FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, flags, flag6, NULL); + NULL, disposition, attributes, NULL); if (file == INVALID_HANDLE_VALUE) { *fd = nullptr;