Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsIConsoleService.h" |
michael@0 | 7 | #include "nsIScriptError.h" |
michael@0 | 8 | |
michael@0 | 9 | #ifndef __FUNCTION__ |
michael@0 | 10 | #define __FUNCTION__ __func__ |
michael@0 | 11 | #endif |
michael@0 | 12 | |
michael@0 | 13 | // Call a method on each observer in a category cache, then call the same |
michael@0 | 14 | // method on the observer array. |
michael@0 | 15 | #define NOTIFY_OBSERVERS(canFire, cache, array, type, method) \ |
michael@0 | 16 | PR_BEGIN_MACRO \ |
michael@0 | 17 | if (canFire) { \ |
michael@0 | 18 | nsCOMArray<type> entries; \ |
michael@0 | 19 | cache.GetEntries(entries); \ |
michael@0 | 20 | for (int32_t idx = 0; idx < entries.Count(); ++idx) \ |
michael@0 | 21 | entries[idx]->method; \ |
michael@0 | 22 | ENUMERATE_WEAKARRAY(array, type, method) \ |
michael@0 | 23 | } \ |
michael@0 | 24 | PR_END_MACRO; |
michael@0 | 25 | |
michael@0 | 26 | #define PLACES_FACTORY_SINGLETON_IMPLEMENTATION(_className, _sInstance) \ |
michael@0 | 27 | _className * _className::_sInstance = nullptr; \ |
michael@0 | 28 | \ |
michael@0 | 29 | already_AddRefed<_className> \ |
michael@0 | 30 | _className::GetSingleton() \ |
michael@0 | 31 | { \ |
michael@0 | 32 | if (_sInstance) { \ |
michael@0 | 33 | nsRefPtr<_className> ret = _sInstance; \ |
michael@0 | 34 | return ret.forget(); \ |
michael@0 | 35 | } \ |
michael@0 | 36 | _sInstance = new _className(); \ |
michael@0 | 37 | nsRefPtr<_className> ret = _sInstance; \ |
michael@0 | 38 | if (NS_FAILED(_sInstance->Init())) { \ |
michael@0 | 39 | /* Null out ret before _sInstance so the destructor doesn't assert */ \ |
michael@0 | 40 | ret = nullptr; \ |
michael@0 | 41 | _sInstance = nullptr; \ |
michael@0 | 42 | return nullptr; \ |
michael@0 | 43 | } \ |
michael@0 | 44 | return ret.forget(); \ |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | #define PLACES_WARN_DEPRECATED() \ |
michael@0 | 48 | PR_BEGIN_MACRO \ |
michael@0 | 49 | nsCString msg = NS_LITERAL_CSTRING(__FUNCTION__); \ |
michael@0 | 50 | msg.AppendLiteral(" is deprecated and will be removed in the next version.");\ |
michael@0 | 51 | NS_WARNING(msg.get()); \ |
michael@0 | 52 | nsCOMPtr<nsIConsoleService> cs = do_GetService(NS_CONSOLESERVICE_CONTRACTID);\ |
michael@0 | 53 | if (cs) { \ |
michael@0 | 54 | nsCOMPtr<nsIScriptError> e = do_CreateInstance(NS_SCRIPTERROR_CONTRACTID); \ |
michael@0 | 55 | if (e && NS_SUCCEEDED(e->Init(NS_ConvertUTF8toUTF16(msg), EmptyString(), \ |
michael@0 | 56 | EmptyString(), 0, 0, \ |
michael@0 | 57 | nsIScriptError::errorFlag, "Places"))) { \ |
michael@0 | 58 | cs->LogMessage(e); \ |
michael@0 | 59 | } \ |
michael@0 | 60 | } \ |
michael@0 | 61 | PR_END_MACRO |