From 12a859a177856c9d4922d84fa0541f0adeac7d4e Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Fri, 28 Sep 2018 00:06:51 +0900 Subject: [PATCH 01/11] Bug 1494518 - Do not pass non-PromiseObject to JSRuntime::enqueuePromiseJob. r=till --- js/src/builtin/Promise.cpp | 20 +++++++++++++++++--- js/src/vm/Runtime.cpp | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/js/src/builtin/Promise.cpp b/js/src/builtin/Promise.cpp index 50248b4c6f04..5b9ee4dcfdd9 100644 --- a/js/src/builtin/Promise.cpp +++ b/js/src/builtin/Promise.cpp @@ -1018,9 +1018,23 @@ EnqueuePromiseReactionJob(JSContext* cx, HandleObject reactionObj, // handler's compartment above, because we should pass objects from a // single compartment to the enqueuePromiseJob callback. RootedObject promise(cx, reaction->promise()); - if (promise && promise->is()) { - if (!cx->compartment()->wrap(cx, &promise)) { - return false; + if (promise) { + if (promise->is()) { + if (!cx->compartment()->wrap(cx, &promise)) { + return false; + } + } else if (IsWrapper(promise)) { + // `promise` can be already-wrapped promise object at this point. + JSObject* unwrappedPromise = UncheckedUnwrap(promise); + if (unwrappedPromise->is()) { + if (!cx->compartment()->wrap(cx, &promise)) { + return false; + } + } else { + promise = nullptr; + } + } else { + promise = nullptr; } } diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp index 0f28c1b91b70..7abdde3957cb 100644 --- a/js/src/vm/Runtime.cpp +++ b/js/src/vm/Runtime.cpp @@ -648,6 +648,10 @@ JSRuntime::enqueuePromiseJob(JSContext* cx, HandleFunction job, HandleObject pro void* data = cx->enqueuePromiseJobCallbackData; RootedObject allocationSite(cx); if (promise) { +#ifdef DEBUG + AssertSameCompartment(job, promise); +#endif + RootedObject unwrappedPromise(cx, promise); // While the job object is guaranteed to be unwrapped, the promise // might be wrapped. See the comments in EnqueuePromiseReactionJob in From d8f65840ccc5de8a4cf25ef201cc818bbb575ef7 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 27 Sep 2018 08:19:41 +0900 Subject: [PATCH 02/11] Bug 1494216 - Use the -Bsymbolic linker flag to build clang. r=froydnj With libLLVM being a shared library exporting many symbols, all internal calls using those symbols default to go through the PLT, which is unnecessary (and costly) overhead. Using -Bsymbolic makes internal calls go directly to the right place without going through the PLT. Differential Revision: https://phabricator.services.mozilla.com/D7029 --- build/build-clang/build-clang.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/build-clang/build-clang.py b/build/build-clang/build-clang.py index 810757188227..2718af9984c6 100755 --- a/build/build-clang/build-clang.py +++ b/build/build-clang/build-clang.py @@ -616,7 +616,8 @@ if __name__ == "__main__": # Silence clang's warnings about arguments not being used in compilation. extra_cxxflags2 = ["-fPIC", '-Qunused-arguments'] extra_asmflags = [] - extra_ldflags = [] + # Avoid libLLVM internal function calls going through the PLT. + extra_ldflags = ['-Wl,-Bsymbolic'] if 'LD_LIBRARY_PATH' in os.environ: os.environ['LD_LIBRARY_PATH'] = ('%s/lib64/:%s' % From 7ed849f7d242c6f3e6df136c49eb24dd93d3b287 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Thu, 27 Sep 2018 19:44:16 -0400 Subject: [PATCH 03/11] Bug 1494712 - fix incorrect preprocessor define for aarch64 in atomicops.h; r=jld --- ipc/chromium/src/base/atomicops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipc/chromium/src/base/atomicops.h b/ipc/chromium/src/base/atomicops.h index ba927a9b4add..777444543ca8 100644 --- a/ipc/chromium/src/base/atomicops.h +++ b/ipc/chromium/src/base/atomicops.h @@ -150,7 +150,7 @@ Atomic64 Release_Load(volatile const Atomic64* ptr); // Include our platform specific implementation. #if defined(OS_WIN) && defined(ARCH_CPU_X86_FAMILY) #include "base/atomicops_internals_x86_msvc.h" -#elif defined(OS_WIN) && defined(ARCH_CPU_AARCH64_FAMILY) +#elif defined(OS_WIN) && defined(ARCH_CPU_ARM64) // Works just fine, separate case in case we need to change things. #include "base/atomicops_internals_x86_msvc.h" #elif defined(OS_MACOSX) && defined(ARCH_CPU_X86_FAMILY) From 6d9aae580d45f54d55a1c0b28412a16d34dfda29 Mon Sep 17 00:00:00 2001 From: sotaro Date: Fri, 28 Sep 2018 09:06:26 +0900 Subject: [PATCH 04/11] Bug 1494528 - Call GPUProcessManager::EnsureGPUReady() before accessing gfxVars::UseWebRender() r=aosmond --- widget/nsBaseWidget.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index 81ff88b3a5f3..aac12f1ddfb5 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -1313,6 +1313,12 @@ nsBaseWidget::CreateCompositorSession(int aWidth, do { CreateCompositorVsyncDispatcher(); + gfx::GPUProcessManager* gpu = gfx::GPUProcessManager::Get(); + // Make sure GPU process is ready for use. + // If it failed to connect to GPU process, GPU process usage is disabled in EnsureGPUReady(). + // It could update gfxVars and gfxConfigs. + gpu->EnsureGPUReady(); + // If widget type does not supports acceleration, we use ClientLayerManager // even when gfxVars::UseWebRender() is true. WebRender could coexist only // with BasicCompositor. @@ -1338,7 +1344,6 @@ nsBaseWidget::CreateCompositorSession(int aWidth, } bool retry = false; - gfx::GPUProcessManager* gpu = gfx::GPUProcessManager::Get(); mCompositorSession = gpu->CreateTopLevelCompositor( this, lm, From 1a784b026bffcd775eb34b78683726f2166bcf4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Fri, 21 Sep 2018 16:22:30 +0200 Subject: [PATCH 05/11] Bug 1492519 - lightweightThemes.selectedThemeID default should be "default-theme@mozilla.org" rather than "". r=aswan --- testing/profiles/perf/user.js | 2 +- testing/profiles/unittest/user.js | 2 +- .../extensions/test/browser/browser_ext_management_themes.js | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/testing/profiles/perf/user.js b/testing/profiles/perf/user.js index 7736d4505e8d..cb9eb1ea8504 100644 --- a/testing/profiles/perf/user.js +++ b/testing/profiles/perf/user.js @@ -66,7 +66,7 @@ user_pref("identity.fxaccounts.auth.uri", "https://127.0.0.1/fxa-dummy/"); user_pref("identity.fxaccounts.migrateToDevEdition", false); // Make tests run consistently on DevEdition (which has a lightweight theme // selected by default). -user_pref("lightweightThemes.selectedThemeID", ""); +user_pref("lightweightThemes.selectedThemeID", "default-theme@mozilla.org"); user_pref("media.capturestream_hints.enabled", true); user_pref("media.gmp-manager.url", "http://127.0.0.1/gmpmanager-dummy/update.xml"); // Don't block old libavcodec libraries when testing, because our test systems diff --git a/testing/profiles/unittest/user.js b/testing/profiles/unittest/user.js index 67c35ed37a03..2fd9d60fa355 100644 --- a/testing/profiles/unittest/user.js +++ b/testing/profiles/unittest/user.js @@ -189,7 +189,7 @@ user_pref("layout.css.shape-outside.enabled", true); user_pref("layout.spammy_warnings.enabled", false); // Make tests run consistently on DevEdition (which has a lightweight theme // selected by default). -user_pref("lightweightThemes.selectedThemeID", ""); +user_pref("lightweightThemes.selectedThemeID", "default-theme@mozilla.org"); // Disable all recommended Marionette preferences for Gecko tests. // The prefs recommended by Marionette are typically geared towards // consumer automation; not vendor testing. diff --git a/toolkit/components/extensions/test/browser/browser_ext_management_themes.js b/toolkit/components/extensions/test/browser/browser_ext_management_themes.js index 4d81dc89eab7..bca911328601 100644 --- a/toolkit/components/extensions/test/browser/browser_ext_management_themes.js +++ b/toolkit/components/extensions/test/browser/browser_ext_management_themes.js @@ -125,6 +125,7 @@ add_task(async function test_management_themes() { }; is(await extension.awaitMessage("onInstalled"), "Bling", "LWT installed"); is(await extension.awaitMessage("onEnabled"), "Bling", "LWT enabled"); + is(await extension.awaitMessage("onDisabled"), "Default", "default disabled"); await theme.startup(); is(await extension.awaitMessage("onInstalled"), "Simple theme test", "webextension theme installed"); From f115950b8e5179252d47476eb58fc69675f11a5a Mon Sep 17 00:00:00 2001 From: Stephen A Pohl Date: Thu, 27 Sep 2018 23:08:07 -0400 Subject: [PATCH 06/11] Bug 1445943: Add Enterprise Policy support for macOS. r=mstange,felipe,glandium --- .../enterprisepolicies/EnterprisePolicies.js | 55 +++++++++-- .../content/aboutPolicies.js | 3 +- .../macOSPoliciesParser.jsm | 39 ++++++++ .../components/enterprisepolicies/moz.build | 5 + xpcom/base/moz.build | 4 + xpcom/base/nsIMacPreferencesReader.idl | 34 +++++++ xpcom/base/nsMacPreferencesReader.h | 32 ++++++ xpcom/base/nsMacPreferencesReader.mm | 97 +++++++++++++++++++ xpcom/build/XPCOMInit.cpp | 12 +++ 9 files changed, 272 insertions(+), 9 deletions(-) create mode 100644 browser/components/enterprisepolicies/macOSPoliciesParser.jsm create mode 100644 xpcom/base/nsIMacPreferencesReader.idl create mode 100644 xpcom/base/nsMacPreferencesReader.h create mode 100644 xpcom/base/nsMacPreferencesReader.mm diff --git a/browser/components/enterprisepolicies/EnterprisePolicies.js b/browser/components/enterprisepolicies/EnterprisePolicies.js index 7825d74514c2..a8f8d3459d5d 100644 --- a/browser/components/enterprisepolicies/EnterprisePolicies.js +++ b/browser/components/enterprisepolicies/EnterprisePolicies.js @@ -8,6 +8,7 @@ ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); XPCOMUtils.defineLazyModuleGetters(this, { WindowsGPOParser: "resource:///modules/policies/WindowsGPOParser.jsm", + macOSPoliciesParser: "resource:///modules/policies/macOSPoliciesParser.jsm", Policies: "resource:///modules/policies/Policies.jsm", JsonSchemaValidator: "resource://gre/modules/components-utils/JsonSchemaValidator.jsm", }); @@ -76,16 +77,19 @@ EnterprisePoliciesManager.prototype = { }, _chooseProvider() { + let provider = null; if (AppConstants.platform == "win") { - let gpoProvider = new GPOPoliciesProvider(); - if (gpoProvider.hasPolicies) { - return gpoProvider; - } + provider = new WindowsGPOPoliciesProvider(); + } else if (AppConstants.platform == "macosx") { + provider = new macOSPoliciesProvider(); + } + if (provider && provider.hasPolicies) { + return provider; } - let jsonProvider = new JSONPoliciesProvider(); - if (jsonProvider.hasPolicies) { - return jsonProvider; + provider = new JSONPoliciesProvider(); + if (provider.hasPolicies) { + return provider; } return null; @@ -395,7 +399,7 @@ class JSONPoliciesProvider { } } -class GPOPoliciesProvider { +class WindowsGPOPoliciesProvider { constructor() { this._policies = null; @@ -429,5 +433,40 @@ class GPOPoliciesProvider { } } +class macOSPoliciesProvider { + constructor() { + let prefReader = Cc["@mozilla.org/mac-preferences-reader;1"] + .createInstance(Ci.nsIMacPreferencesReader); + if (!prefReader.policiesEnabled()) { + return; + } + this._policies = macOSPoliciesParser.readPolicies(prefReader); + this._removeUnknownPolicies(); + } + + _removeUnknownPolicies() { + let { schema } = ChromeUtils.import("resource:///modules/policies/schema.jsm", {}); + + for (let policyName of Object.keys(this._policies)) { + if (!schema.properties.hasOwnProperty(policyName)) { + log.debug(`Removing unknown policy: ${policyName}`); + delete this._policies[policyName]; + } + } + } + + get hasPolicies() { + return this._policies !== null; + } + + get policies() { + return this._policies; + } + + get failed() { + return this._failed; + } +} + var components = [EnterprisePoliciesManager]; this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); diff --git a/browser/components/enterprisepolicies/content/aboutPolicies.js b/browser/components/enterprisepolicies/content/aboutPolicies.js index 826699e8aea1..68b75cf82a92 100644 --- a/browser/components/enterprisepolicies/content/aboutPolicies.js +++ b/browser/components/enterprisepolicies/content/aboutPolicies.js @@ -204,7 +204,8 @@ function generateErrors() { "Enterprise Policies Child", "BookmarksPolicies.jsm", "ProxyPolicies.jsm", - "WebsiteFilter Policy"]; + "WebsiteFilter Policy", + "macOSPoliciesParser.jsm"]; let new_cont = document.getElementById("errorsContent"); new_cont.classList.add("errors"); diff --git a/browser/components/enterprisepolicies/macOSPoliciesParser.jsm b/browser/components/enterprisepolicies/macOSPoliciesParser.jsm new file mode 100644 index 000000000000..9d62c60f8635 --- /dev/null +++ b/browser/components/enterprisepolicies/macOSPoliciesParser.jsm @@ -0,0 +1,39 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); + +const PREF_LOGLEVEL = "browser.policies.loglevel"; + +XPCOMUtils.defineLazyGetter(this, "log", () => { + let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm", {}); + return new ConsoleAPI({ + prefix: "macOSPoliciesParser.jsm", + // tip: set maxLogLevel to "debug" and use log.debug() to create detailed + // messages during development. See LOG_LEVELS in Console.jsm for details. + maxLogLevel: "error", + maxLogLevelPref: PREF_LOGLEVEL, + }); +}); + +var EXPORTED_SYMBOLS = ["macOSPoliciesParser"]; + +var macOSPoliciesParser = { + readPolicies(reader) { + let nativePolicies = reader.readPreferences(); + if (!nativePolicies) { + return null; + } + + // Need an extra check here so we don't + // JSON.stringify if we aren't in debug mode + if (log.maxLogLevel == "debug") { + log.debug(JSON.stringify(nativePolicies, null, 2)); + } + + return nativePolicies; + } +}; diff --git a/browser/components/enterprisepolicies/moz.build b/browser/components/enterprisepolicies/moz.build index c849ea84d179..bf07965bd018 100644 --- a/browser/components/enterprisepolicies/moz.build +++ b/browser/components/enterprisepolicies/moz.build @@ -31,6 +31,11 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': 'WindowsGPOParser.jsm', ] +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': + EXTRA_JS_MODULES.policies += [ + 'macOSPoliciesParser.jsm', +] + FINAL_LIBRARY = 'browsercomps' JAR_MANIFESTS += ['jar.mn'] diff --git a/xpcom/base/moz.build b/xpcom/base/moz.build index d17973c7ffa1..2b8f2511d642 100644 --- a/xpcom/base/moz.build +++ b/xpcom/base/moz.build @@ -30,15 +30,18 @@ XPIDL_SOURCES += [ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': XPIDL_SOURCES += [ + 'nsIMacPreferencesReader.idl', 'nsIMacUtils.idl', ] EXPORTS.mozilla += [ 'MacHelpers.h', 'MacStringHelpers.h', + 'nsMacPreferencesReader.h', ] UNIFIED_SOURCES += [ 'MacHelpers.mm', 'MacStringHelpers.mm', + 'nsMacPreferencesReader.mm', ] XPIDL_MODULE = 'xpcom_base' @@ -213,6 +216,7 @@ FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ '../build', '/dom/base', + '/mfbt', '/xpcom/ds', ] diff --git a/xpcom/base/nsIMacPreferencesReader.idl b/xpcom/base/nsIMacPreferencesReader.idl new file mode 100644 index 000000000000..fb67d4a85ebd --- /dev/null +++ b/xpcom/base/nsIMacPreferencesReader.idl @@ -0,0 +1,34 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupportsPrimitives.idl" + +%{C++ +#define ENTERPRISE_POLICIES_ENABLED_KEY "EnterprisePoliciesEnabled" +%} + +/** + * This interface is designed to provide scriptable access to the macOS + * preferences system. + * + * This interface is highly macOS specific. + */ +[scriptable, uuid(06da64da-647f-4286-ac20-50ab4190cfe3)] +interface nsIMacPreferencesReader : nsISupports +{ + /** + * This method checks whether macOS policies are enabled. + * + * @return true if macOS policies are enabled, false otherwise. + */ + bool policiesEnabled(); + + /** + * This method reads and returns the macOS preferences. + * + * @return A JSON object containing all macOS preferences. + */ + [implicit_jscontext] + jsval readPreferences(); +}; diff --git a/xpcom/base/nsMacPreferencesReader.h b/xpcom/base/nsMacPreferencesReader.h new file mode 100644 index 000000000000..009fb66a4f04 --- /dev/null +++ b/xpcom/base/nsMacPreferencesReader.h @@ -0,0 +1,32 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef MacPreferencesReader_h__ +#define MacPreferencesReader_h__ + +//----------------------------------------------------------------------------- + +#include "nsIMacPreferencesReader.h" + +#define NS_MACPREFERENCESREADER_CID \ +{ 0x95790842, 0x75a0, 0x430d, \ + { 0x98, 0xbf, 0xf5, 0xce, 0x37, 0x88, 0xea, 0x6d } } +#define NS_MACPREFERENCESREADER_CONTRACTID \ + "@mozilla.org/mac-preferences-reader;1" + +//----------------------------------------------------------------------------- + +class nsMacPreferencesReader : public nsIMacPreferencesReader +{ +public: + NS_DECL_ISUPPORTS + NS_DECL_NSIMACPREFERENCESREADER + + nsMacPreferencesReader() {}; + +protected: + virtual ~nsMacPreferencesReader() = default; +}; + +#endif // MacPreferencesReader_h__ diff --git a/xpcom/base/nsMacPreferencesReader.mm b/xpcom/base/nsMacPreferencesReader.mm new file mode 100644 index 000000000000..5ae5bd6cbb1a --- /dev/null +++ b/xpcom/base/nsMacPreferencesReader.mm @@ -0,0 +1,97 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsMacPreferencesReader.h" + +#include "js/JSON.h" +#include "JSONWriter.h" +#include "nsISupportsPrimitives.h" + +NS_IMPL_ISUPPORTS(nsMacPreferencesReader, nsIMacPreferencesReader) + +using namespace mozilla; + +struct StringWriteFunc : public JSONWriteFunc +{ + nsCString& mCString; + explicit StringWriteFunc(nsCString& aCString) : mCString(aCString) + { + } + void Write(const char* aStr) override { mCString.Append(aStr); } +}; + +static void +EvaluateDict(JSONWriter* aWriter, NSDictionary* aDict); + +static void +EvaluateArray(JSONWriter* aWriter, NSArray* aArray) +{ + for (id elem in aArray) { + if ([elem isKindOfClass:[NSString class]]) { + aWriter->StringElement([elem UTF8String]); + } else if ([elem isKindOfClass:[NSNumber class]]) { + aWriter->IntElement([elem longLongValue]); + } else if ([elem isKindOfClass:[NSArray class]]) { + aWriter->StartArrayElement(); + EvaluateArray(aWriter, elem); + aWriter->EndArray(); + } else if ([elem isKindOfClass:[NSDictionary class]]) { + aWriter->StartObjectElement(); + EvaluateDict(aWriter, elem); + aWriter->EndObject(); + } + } +} + +static void +EvaluateDict(JSONWriter* aWriter, NSDictionary* aDict) +{ + for (NSString* key in aDict) { + id value = aDict[key]; + if ([value isKindOfClass:[NSString class]]) { + aWriter->StringProperty([key UTF8String], [value UTF8String]); + } else if ([value isKindOfClass:[NSNumber class]]) { + aWriter->IntProperty([key UTF8String], [value longLongValue]); + } else if ([value isKindOfClass:[NSArray class]]) { + aWriter->StartArrayProperty([key UTF8String]); + EvaluateArray(aWriter, value); + aWriter->EndArray(); + } else if ([value isKindOfClass:[NSDictionary class]]) { + aWriter->StartObjectProperty([key UTF8String]); + EvaluateDict(aWriter, value); + aWriter->EndObject(); + } + } +} + +NS_IMETHODIMP +nsMacPreferencesReader::PoliciesEnabled(bool* aPoliciesEnabled) +{ + NSString* policiesEnabledStr = + [NSString stringWithUTF8String:ENTERPRISE_POLICIES_ENABLED_KEY]; + *aPoliciesEnabled = [[NSUserDefaults standardUserDefaults] + boolForKey:policiesEnabledStr] == YES; + return NS_OK; +} + +NS_IMETHODIMP +nsMacPreferencesReader::ReadPreferences(JSContext* aCx, + JS::MutableHandle aResult) +{ + nsAutoCString jsonStr; + JSONWriter w(MakeUnique(jsonStr)); + w.Start(); + EvaluateDict(&w, [[NSUserDefaults standardUserDefaults] + dictionaryRepresentation]); + w.End(); + + NS_ConvertUTF8toUTF16 jsString(nsDependentCString(jsonStr.get())); + auto json = static_cast(jsString.get()); + + JS::RootedValue val(aCx); + MOZ_ALWAYS_TRUE(JS_ParseJSON(aCx, json, jsonStr.Length(), &val)); + + aResult.set(val); + return NS_OK; +} diff --git a/xpcom/build/XPCOMInit.cpp b/xpcom/build/XPCOMInit.cpp index 767b9f1504f8..bef4f22c55bb 100644 --- a/xpcom/build/XPCOMInit.cpp +++ b/xpcom/build/XPCOMInit.cpp @@ -93,6 +93,7 @@ extern nsresult nsStringInputStreamConstructor(nsISupports*, REFNSIID, void**); #ifdef MOZ_WIDGET_COCOA #include "nsMacUtilsImpl.h" +#include "nsMacPreferencesReader.h" #endif #include "nsSystemInfo.h" @@ -213,6 +214,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUUIDGenerator, Init) #ifdef MOZ_WIDGET_COCOA NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacUtilsImpl) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacPreferencesReader) #endif NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemInfo, Init) @@ -251,6 +253,10 @@ NS_DEFINE_NAMED_CID(NS_CHROMEPROTOCOLHANDLER_CID); NS_DEFINE_NAMED_CID(NS_SECURITY_CONSOLE_MESSAGE_CID); +#ifdef MOZ_WIDGET_COCOA +NS_DEFINE_NAMED_CID(NS_MACPREFERENCESREADER_CID); +#endif + NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsChromeRegistry, nsChromeRegistry::GetSingleton) NS_GENERIC_FACTORY_CONSTRUCTOR(nsChromeProtocolHandler) @@ -278,6 +284,9 @@ const mozilla::Module::CIDEntry kXPCOMCIDEntries[] = { { &kNS_CHROMEREGISTRY_CID, false, nullptr, nsChromeRegistryConstructor }, { &kNS_CHROMEPROTOCOLHANDLER_CID, false, nullptr, nsChromeProtocolHandlerConstructor }, { &kNS_SECURITY_CONSOLE_MESSAGE_CID, false, nullptr, nsSecurityConsoleMessageConstructor }, +#ifdef MOZ_WIDGET_COCOA + { &kNS_MACPREFERENCESREADER_CID, false, nullptr, nsMacPreferencesReaderConstructor }, +#endif { nullptr } }; #undef COMPONENT @@ -291,6 +300,9 @@ const mozilla::Module::ContractIDEntry kXPCOMContracts[] = { { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "chrome", &kNS_CHROMEPROTOCOLHANDLER_CID }, { NS_INIPARSERFACTORY_CONTRACTID, &kINIParserFactoryCID }, { NS_SECURITY_CONSOLE_MESSAGE_CONTRACTID, &kNS_SECURITY_CONSOLE_MESSAGE_CID }, +#ifdef MOZ_WIDGET_COCOA + { NS_MACPREFERENCESREADER_CONTRACTID, &kNS_MACPREFERENCESREADER_CID }, +#endif { nullptr } }; #undef COMPONENT From 3b805a479e85e78fbe0ed5077645a235c8ce5268 Mon Sep 17 00:00:00 2001 From: Dorel Luca Date: Fri, 28 Sep 2018 06:35:55 +0300 Subject: [PATCH 07/11] Backed out changeset 5d60b68a0a42 (bug 1494216) for xpcshell failures in memory/replace/dmd/test/test_dmd.js. CLOSED TREE --- build/build-clang/build-clang.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build/build-clang/build-clang.py b/build/build-clang/build-clang.py index 2718af9984c6..810757188227 100755 --- a/build/build-clang/build-clang.py +++ b/build/build-clang/build-clang.py @@ -616,8 +616,7 @@ if __name__ == "__main__": # Silence clang's warnings about arguments not being used in compilation. extra_cxxflags2 = ["-fPIC", '-Qunused-arguments'] extra_asmflags = [] - # Avoid libLLVM internal function calls going through the PLT. - extra_ldflags = ['-Wl,-Bsymbolic'] + extra_ldflags = [] if 'LD_LIBRARY_PATH' in os.environ: os.environ['LD_LIBRARY_PATH'] = ('%s/lib64/:%s' % From 75d82dfbf5515e8172ed484c11abf843d7204c57 Mon Sep 17 00:00:00 2001 From: Stephen A Pohl Date: Thu, 27 Sep 2018 23:54:18 -0400 Subject: [PATCH 08/11] Bug 1445943: Fix ES lint error on inbound due to a missing comma and macOS test failures. r=me CLOSED TREE --- browser/components/enterprisepolicies/EnterprisePolicies.js | 1 + browser/components/enterprisepolicies/macOSPoliciesParser.jsm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/browser/components/enterprisepolicies/EnterprisePolicies.js b/browser/components/enterprisepolicies/EnterprisePolicies.js index a8f8d3459d5d..d319392437ce 100644 --- a/browser/components/enterprisepolicies/EnterprisePolicies.js +++ b/browser/components/enterprisepolicies/EnterprisePolicies.js @@ -435,6 +435,7 @@ class WindowsGPOPoliciesProvider { class macOSPoliciesProvider { constructor() { + this._policies = null; let prefReader = Cc["@mozilla.org/mac-preferences-reader;1"] .createInstance(Ci.nsIMacPreferencesReader); if (!prefReader.policiesEnabled()) { diff --git a/browser/components/enterprisepolicies/macOSPoliciesParser.jsm b/browser/components/enterprisepolicies/macOSPoliciesParser.jsm index 9d62c60f8635..60d0295f30ae 100644 --- a/browser/components/enterprisepolicies/macOSPoliciesParser.jsm +++ b/browser/components/enterprisepolicies/macOSPoliciesParser.jsm @@ -35,5 +35,5 @@ var macOSPoliciesParser = { } return nativePolicies; - } + }, }; From 2d103b2506e8a67158c0ab2efd6cf9e0471d527f Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 27 Sep 2018 23:29:15 -0400 Subject: [PATCH 09/11] Bug 1494206. Update webrender to commit 0d2e9611c07e04ac830277f16a3b46bf125b9e7c --HG-- extra : rebase_source : 819d34566c0b1085f5b8388aec934fb31e53581d --- gfx/webrender/res/cs_blur.glsl | 15 +++++-- gfx/webrender/src/border.rs | 6 ++- gfx/webrender/src/clip_scroll_tree.rs | 24 ++++++----- gfx/webrender/src/device/gl.rs | 2 +- gfx/webrender/src/frame_builder.rs | 4 +- gfx/webrender/src/gpu_types.rs | 11 +++-- gfx/webrender/src/render_backend.rs | 62 +++++++++++++++------------ gfx/webrender/src/scene_builder.rs | 12 +++--- gfx/webrender_api/src/image.rs | 2 +- gfx/webrender_bindings/revision.txt | 2 +- 10 files changed, 85 insertions(+), 55 deletions(-) diff --git a/gfx/webrender/res/cs_blur.glsl b/gfx/webrender/res/cs_blur.glsl index f089f913d8fc..af7121c76c89 100644 --- a/gfx/webrender/res/cs_blur.glsl +++ b/gfx/webrender/res/cs_blur.glsl @@ -8,7 +8,8 @@ varying vec3 vUv; flat varying vec4 vUvRect; flat varying vec2 vOffsetScale; flat varying float vSigma; -flat varying int vBlurRadius; +// The number of pixels on each end that we apply the blur filter over. +flat varying int vSupport; #ifdef WR_VERTEX_SHADER // Applies a separable gaussian blur in one direction, as specified @@ -50,9 +51,15 @@ void main(void) { vec2 texture_size = vec2(textureSize(sCacheA8, 0).xy); #endif vUv.z = src_task.texture_layer_index; - vBlurRadius = int(3.0 * blur_task.blur_radius); vSigma = blur_task.blur_radius; + // Ensure that the support is an even number of pixels to simplify the + // fragment shader logic. + // + // TODO(pcwalton): Actually make use of this fact and use the texture + // hardware for linear filtering. + vSupport = int(ceil(1.5 * blur_task.blur_radius)) * 2; + switch (aBlurDirection) { case DIR_HORIZONTAL: vOffsetScale = vec2(1.0 / texture_size.x, 0.0); @@ -101,7 +108,7 @@ void main(void) { // TODO(gw): The gauss function gets NaNs when blur radius // is zero. In the future, detect this earlier // and skip the blur passes completely. - if (vBlurRadius == 0) { + if (vSupport == 0) { oFragColor = vec4(original_color); return; } @@ -117,7 +124,7 @@ void main(void) { gauss_coefficient_sum += gauss_coefficient.x; gauss_coefficient.xy *= gauss_coefficient.yz; - for (int i=1 ; i <= vBlurRadius ; ++i) { + for (int i = 1; i <= vSupport; i++) { vec2 offset = vOffsetScale * float(i); vec2 st0 = clamp(vUv.xy - offset, vUvRect.xy, vUvRect.zw); diff --git a/gfx/webrender/src/border.rs b/gfx/webrender/src/border.rs index a016a7797546..62eaf8bb9aa4 100644 --- a/gfx/webrender/src/border.rs +++ b/gfx/webrender/src/border.rs @@ -214,9 +214,11 @@ impl BorderSideHelpers for BorderSide { // modulate the colors in order to generate colors for the inset/outset // and groove/ridge border styles. // + // NOTE(emilio): Gecko at least takes the background color into + // account, should we do the same? Looks a bit annoying for this. + // // NOTE(emilio): If you change this algorithm, do the same change on - // get_colors_for_side in cs_border_segment.glsl, and - // NS_GetSpecial3DColors in Gecko. + // get_colors_for_side in cs_border_segment.glsl. if self.color.r != 0.0 || self.color.g != 0.0 || self.color.b != 0.0 { let scale = if lighter { 1.0 } else { 2.0 / 3.0 }; return self.color.scale_rgb(scale) diff --git a/gfx/webrender/src/clip_scroll_tree.rs b/gfx/webrender/src/clip_scroll_tree.rs index 6d85f1b8c935..d105beb31200 100644 --- a/gfx/webrender/src/clip_scroll_tree.rs +++ b/gfx/webrender/src/clip_scroll_tree.rs @@ -253,10 +253,14 @@ impl ClipScrollTree { &mut self, pan: WorldPoint, scene_properties: &SceneProperties, - ) -> TransformPalette { - let mut transform_palette = TransformPalette::new(self.spatial_nodes.len()); + mut transform_palette: Option<&mut TransformPalette>, + ) { if self.spatial_nodes.is_empty() { - return transform_palette; + return; + } + + if let Some(ref mut palette) = transform_palette { + palette.allocate(self.spatial_nodes.len()); } self.coord_systems.clear(); @@ -282,7 +286,9 @@ impl ClipScrollTree { }; node.update(&mut state, &mut self.coord_systems, scene_properties); - node.push_gpu_data(&mut transform_palette, node_index); + if let Some(ref mut palette) = transform_palette { + node.push_gpu_data(palette, node_index); + } if !node.children.is_empty() { node.prepare_state_for_children(&mut state); @@ -293,8 +299,6 @@ impl ClipScrollTree { ); } } - - transform_palette } pub fn finalize_and_apply_pending_scroll_offsets(&mut self, old_states: ScrollStates) { @@ -506,7 +510,7 @@ fn test_cst_simple_translation() { LayoutVector2D::zero(), ); - cst.update_tree(WorldPoint::zero(), &SceneProperties::new()); + cst.update_tree(WorldPoint::zero(), &SceneProperties::new(), None); test_pt(100.0, 100.0, &cst, child1, root, 200.0, 100.0); test_pt(100.0, 100.0, &cst, root, child1, 0.0, 100.0); @@ -551,7 +555,7 @@ fn test_cst_simple_scale() { LayoutVector2D::zero(), ); - cst.update_tree(WorldPoint::zero(), &SceneProperties::new()); + cst.update_tree(WorldPoint::zero(), &SceneProperties::new(), None); test_pt(100.0, 100.0, &cst, child1, root, 400.0, 100.0); test_pt(100.0, 100.0, &cst, root, child1, 25.0, 100.0); @@ -605,7 +609,7 @@ fn test_cst_scale_translation() { LayoutVector2D::zero(), ); - cst.update_tree(WorldPoint::zero(), &SceneProperties::new()); + cst.update_tree(WorldPoint::zero(), &SceneProperties::new(), None); test_pt(100.0, 100.0, &cst, child1, root, 200.0, 150.0); test_pt(100.0, 100.0, &cst, child2, root, 300.0, 450.0); @@ -644,7 +648,7 @@ fn test_cst_translation_rotate() { LayoutVector2D::zero(), ); - cst.update_tree(WorldPoint::zero(), &SceneProperties::new()); + cst.update_tree(WorldPoint::zero(), &SceneProperties::new(), None); test_pt(100.0, 0.0, &cst, child1, root, 0.0, -100.0); } diff --git a/gfx/webrender/src/device/gl.rs b/gfx/webrender/src/device/gl.rs index 176c4de57fbc..cbc341670f0e 100644 --- a/gfx/webrender/src/device/gl.rs +++ b/gfx/webrender/src/device/gl.rs @@ -2235,7 +2235,7 @@ impl Device { fn gl_describe_format(&self, format: ImageFormat) -> FormatDesc { match format { ImageFormat::R8 => FormatDesc { - internal: gl::RED as _, + internal: gl::R8 as _, external: gl::RED, pixel_type: gl::UNSIGNED_BYTE, }, diff --git a/gfx/webrender/src/frame_builder.rs b/gfx/webrender/src/frame_builder.rs index b1823078e4bb..3966285d9b82 100644 --- a/gfx/webrender/src/frame_builder.rs +++ b/gfx/webrender/src/frame_builder.rs @@ -348,9 +348,11 @@ impl FrameBuilder { resource_cache.begin_frame(frame_id); gpu_cache.begin_frame(); - let mut transform_palette = clip_scroll_tree.update_tree( + let mut transform_palette = TransformPalette::new(); + clip_scroll_tree.update_tree( pan, scene_properties, + Some(&mut transform_palette), ); self.update_scroll_bars(clip_scroll_tree, gpu_cache); diff --git a/gfx/webrender/src/gpu_types.rs b/gfx/webrender/src/gpu_types.rs index c13bd47333dd..88fe4c91ef18 100644 --- a/gfx/webrender/src/gpu_types.rs +++ b/gfx/webrender/src/gpu_types.rs @@ -427,14 +427,19 @@ pub struct TransformPalette { } impl TransformPalette { - pub fn new(spatial_node_count: usize) -> Self { + pub fn new() -> Self { TransformPalette { - transforms: vec![TransformData::invalid(); spatial_node_count], - metadata: vec![TransformMetadata::invalid(); spatial_node_count], + transforms: Vec::new(), + metadata: Vec::new(), map: FastHashMap::default(), } } + pub fn allocate(&mut self, count: usize) { + self.transforms = vec![TransformData::invalid(); count]; + self.metadata = vec![TransformMetadata::invalid(); count]; + } + pub fn set_world_transform( &mut self, index: SpatialNodeIndex, diff --git a/gfx/webrender/src/render_backend.rs b/gfx/webrender/src/render_backend.rs index 3bf88de05fa1..226d47a2723f 100644 --- a/gfx/webrender/src/render_backend.rs +++ b/gfx/webrender/src/render_backend.rs @@ -42,7 +42,7 @@ use serde::{Serialize, Deserialize}; use serde_json; #[cfg(any(feature = "capture", feature = "replay"))] use std::path::PathBuf; -use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering}; +use std::sync::atomic::{AtomicUsize, Ordering}; use std::mem::replace; use std::os::raw::c_void; use std::sync::mpsc::{channel, Sender, Receiver}; @@ -206,6 +206,9 @@ impl Document { }; } FrameMsg::HitTest(pipeline_id, point, flags, tx) => { + if !self.hit_tester_is_valid { + self.rebuild_hit_tester(); + } let result = match self.hit_tester { Some(ref hit_tester) => { @@ -293,6 +296,24 @@ impl Document { } } + fn rebuild_hit_tester(&mut self) { + if let Some(ref mut frame_builder) = self.frame_builder { + let accumulated_scale_factor = self.view.accumulated_scale_factor(); + let pan = self.view.pan.to_f32() / accumulated_scale_factor; + + self.clip_scroll_tree.update_tree( + pan, + &self.dynamic_properties, + None, + ); + + self.hit_tester = Some(frame_builder.create_hit_tester( + &self.clip_scroll_tree, + &self.clip_data_store, + )); + } + } + pub fn updated_pipeline_info(&mut self) -> PipelineInfo { let removed_pipelines = replace(&mut self.removed_pipelines, Vec::new()); PipelineInfo { @@ -347,20 +368,19 @@ impl Document { struct DocumentOps { scroll: bool, - build_frame: bool, } impl DocumentOps { fn nop() -> Self { DocumentOps { scroll: false, - build_frame: false, } } } /// The unique id for WR resource identification. -static NEXT_NAMESPACE_ID: AtomicUsize = ATOMIC_USIZE_INIT; +/// The namespace_id should start from 1. +static NEXT_NAMESPACE_ID: AtomicUsize = AtomicUsize::new(1); #[cfg(any(feature = "capture", feature = "replay"))] #[cfg_attr(feature = "capture", derive(Serialize))] @@ -419,9 +439,6 @@ impl RenderBackend { sampler: Option>, size_of_op: Option, ) -> RenderBackend { - // The namespace_id should start from 1. - NEXT_NAMESPACE_ID.fetch_add(1, Ordering::Relaxed); - RenderBackend { api_rx, payload_rx, @@ -615,7 +632,6 @@ impl RenderBackend { txn.clip_updates.take(), replace(&mut txn.frame_ops, Vec::new()), replace(&mut txn.notifications, Vec::new()), - txn.build_frame, txn.render_frame, &mut frame_counter, &mut profile_counters, @@ -625,6 +641,9 @@ impl RenderBackend { SceneBuilderResult::FlushComplete(tx) => { tx.send(()).ok(); } + SceneBuilderResult::ExternalEvent(evt) => { + self.notifier.external_event(evt); + } SceneBuilderResult::Stopped => { panic!("We haven't sent a Stop yet, how did we get a Stopped back?"); } @@ -727,7 +746,7 @@ impl RenderBackend { ).unwrap(); } ApiMsg::ExternalEvent(evt) => { - self.notifier.external_event(evt); + self.low_priority_scene_tx.send(SceneBuilderRequest::ExternalEvent(evt)).unwrap(); } ApiMsg::ClearNamespace(namespace_id) => { self.resource_cache.clear_namespace(namespace_id); @@ -885,7 +904,6 @@ impl RenderBackend { rasterized_blobs: Vec::new(), notifications: transaction_msg.notifications, set_root_pipeline: None, - build_frame: transaction_msg.generate_frame, render_frame: transaction_msg.generate_frame, }); @@ -921,7 +939,6 @@ impl RenderBackend { None, replace(&mut txn.frame_ops, Vec::new()), replace(&mut txn.notifications, Vec::new()), - txn.build_frame, txn.render_frame, frame_counter, profile_counters, @@ -959,7 +976,6 @@ impl RenderBackend { clip_updates: Option, mut frame_ops: Vec, mut notifications: Vec, - mut build_frame: bool, mut render_frame: bool, frame_counter: &mut u32, profile_counters: &mut BackendProfileCounters, @@ -972,7 +988,7 @@ impl RenderBackend { // fiddle with things after a potentially long scene build, but just // before rendering. This is useful for rendering with the latest // async transforms. - if build_frame { + if requested_frame || has_built_scene { if let Some(ref sampler) = self.sampler { frame_ops.append(&mut sampler.sample()); } @@ -992,7 +1008,6 @@ impl RenderBackend { for frame_msg in frame_ops { let _timer = profile_counters.total_time.timer(); let op = doc.process_frame_msg(frame_msg); - build_frame |= op.build_frame; scroll |= op.scroll; } @@ -1007,31 +1022,20 @@ impl RenderBackend { &mut profile_counters.resources, ); - // After applying the new scene we need to - // rebuild the hit-tester, so we trigger a frame generation - // step. - // - // TODO: We could avoid some the cost of building the frame by only - // building the information required for hit-testing (See #2807). - build_frame |= has_built_scene; - if doc.dynamic_properties.flush_pending_updates() { doc.frame_is_valid = false; doc.hit_tester_is_valid = false; - build_frame = true; } if !doc.can_render() { // TODO: this happens if we are building the first scene asynchronously and // scroll at the same time. we should keep track of the fact that we skipped // composition here and do it as soon as we receive the scene. - build_frame = false; render_frame = false; } - if doc.frame_is_valid { - build_frame = false; - } + // Avoid re-building the frame if the current built frame is still valid. + let build_frame = render_frame && !doc.frame_is_valid; let mut frame_build_time = None; if build_frame && doc.has_pixels() { @@ -1100,6 +1104,10 @@ impl RenderBackend { if requested_frame { self.notifier.new_frame_ready(document_id, scroll, render_frame, frame_build_time); } + + if !doc.hit_tester_is_valid { + doc.rebuild_hit_tester(); + } } #[cfg(not(feature = "debugger"))] diff --git a/gfx/webrender/src/scene_builder.rs b/gfx/webrender/src/scene_builder.rs index c2778064d456..a76444abd78a 100644 --- a/gfx/webrender/src/scene_builder.rs +++ b/gfx/webrender/src/scene_builder.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use api::{AsyncBlobImageRasterizer, BlobImageRequest, BlobImageParams, BlobImageResult}; -use api::{DocumentId, PipelineId, ApiMsg, FrameMsg, ResourceUpdate, Epoch}; +use api::{DocumentId, PipelineId, ApiMsg, FrameMsg, ResourceUpdate, ExternalEvent, Epoch}; use api::{BuiltDisplayList, ColorF, LayoutSize, NotificationRequest, Checkpoint}; use api::channel::MsgSender; #[cfg(feature = "capture")] @@ -39,7 +39,6 @@ pub struct Transaction { pub frame_ops: Vec, pub notifications: Vec, pub set_root_pipeline: Option, - pub build_frame: bool, pub render_frame: bool, } @@ -73,7 +72,6 @@ pub struct BuiltTransaction { pub clip_updates: Option, pub scene_build_start_time: u64, pub scene_build_end_time: u64, - pub build_frame: bool, pub render_frame: bool, } @@ -116,6 +114,7 @@ pub struct BuiltScene { // Message from render backend to scene builder. pub enum SceneBuilderRequest { Transaction(Box), + ExternalEvent(ExternalEvent), DeleteDocument(DocumentId), WakeUp, Flush(MsgSender<()>), @@ -132,6 +131,7 @@ pub enum SceneBuilderRequest { // Message from scene builder to render backend. pub enum SceneBuilderResult { Transaction(Box, Option>), + ExternalEvent(ExternalEvent), FlushComplete(MsgSender<()>), Stopped, } @@ -228,6 +228,10 @@ impl SceneBuilder { Ok(SceneBuilderRequest::SaveScene(config)) => { self.save_scene(config); } + Ok(SceneBuilderRequest::ExternalEvent(evt)) => { + self.tx.send(SceneBuilderResult::ExternalEvent(evt)).unwrap(); + self.api_tx.send(ApiMsg::WakeUp).unwrap(); + } Ok(SceneBuilderRequest::Stop) => { self.tx.send(SceneBuilderResult::Stopped).unwrap(); // We don't need to send a WakeUp to api_tx because we only @@ -307,7 +311,6 @@ impl SceneBuilder { let txn = Box::new(BuiltTransaction { document_id: item.document_id, - build_frame: true, render_frame: item.build_frame, built_scene, resource_updates: Vec::new(), @@ -408,7 +411,6 @@ impl SceneBuilder { Box::new(BuiltTransaction { document_id: txn.document_id, - build_frame: txn.build_frame || built_scene.is_some(), render_frame: txn.render_frame, built_scene, rasterized_blobs, diff --git a/gfx/webrender_api/src/image.rs b/gfx/webrender_api/src/image.rs index 1e7ba53f4f51..48ad0c96c7fb 100644 --- a/gfx/webrender_api/src/image.rs +++ b/gfx/webrender_api/src/image.rs @@ -379,7 +379,7 @@ pub struct BlobImageDescriptor { /// Representation of a rasterized blob image. This is obtained by passing /// `BlobImageData` to the embedding via the rasterization callback. pub struct RasterizedBlobImage { - /// The bounding rectangle for this bob image. + /// The bounding rectangle for this blob image. pub rasterized_rect: DeviceUintRect, /// Backing store. The format is stored out of band in `BlobImageDescriptor`. pub data: Arc>, diff --git a/gfx/webrender_bindings/revision.txt b/gfx/webrender_bindings/revision.txt index b39163aa9202..3133ed4c700e 100644 --- a/gfx/webrender_bindings/revision.txt +++ b/gfx/webrender_bindings/revision.txt @@ -1 +1 @@ -43e8d85789efb95099affe3257a9c254ef3d2f4c +0d2e9611c07e04ac830277f16a3b46bf125b9e7c From 4407187413369c172471d29ffecce2aa2e624b82 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 27 Sep 2018 23:30:38 -0400 Subject: [PATCH 10/11] Bug 1494206. Update tests for blur changes. --HG-- extra : rebase_source : 88411ee6146fbf2781bcdaee4e3668a2b1473b34 --- .../svg/filters/css-filter-chains/reftest.list | 4 ++-- .../reftests/svg/filters/css-filters/reftest.list | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/layout/reftests/svg/filters/css-filter-chains/reftest.list b/layout/reftests/svg/filters/css-filter-chains/reftest.list index accd8ae791ed..77fdaec0b345 100644 --- a/layout/reftests/svg/filters/css-filter-chains/reftest.list +++ b/layout/reftests/svg/filters/css-filter-chains/reftest.list @@ -2,6 +2,6 @@ # e.g. filter: blur(3px) grayscale(0.5) invert(0.2); # Some platforms render this complex filter chain a little differently, and that's ok. -fuzzy(0-5,0-13638) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)&&layersGPUAccelerated,0-35,0-13638) fuzzy-if(webrender,5-6,17922-18643) == long-chain.html long-chain-ref.html # Win10: Bug 1258241 +fuzzy(0-5,0-13638) fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)&&layersGPUAccelerated,0-35,0-13638) fuzzy-if(webrender,5-6,17922-18853) == long-chain.html long-chain-ref.html # Win10: Bug 1258241 == moz-element.html moz-element-ref.html -fuzzy-if(webrender,15-15,7958-8262) == same-filter.html same-filter-ref.html +fuzzy-if(webrender,15-15,7678-8262) == same-filter.html same-filter-ref.html diff --git a/layout/reftests/svg/filters/css-filters/reftest.list b/layout/reftests/svg/filters/css-filters/reftest.list index ce0d9b5c2242..86b0fc1c898f 100644 --- a/layout/reftests/svg/filters/css-filters/reftest.list +++ b/layout/reftests/svg/filters/css-filters/reftest.list @@ -1,16 +1,16 @@ # These tests verify that CSS filters behave properly. # e.g. filter: blur(3px) -fuzzy-if(webrender,9-9,4780-4784) == blur.html blur-ref.html +fuzzy-if(webrender,9-9,4780-5120) == blur.html blur-ref.html == blur.svg blur-ref.svg == blur-calc.html blur-calc-ref.html == blur-calc-negative.html blur-calc-negative-ref.html fuzzy-if(cocoaWidget&&webrender,1-1,1-1) skip-if(d2d) == blur-cap-large-radius-on-software.html blur-cap-large-radius-on-software-ref.html -fuzzy-if(webrender,9-9,4780-4784) == blur-em-radius.html blur-em-radius-ref.html +fuzzy-if(webrender,9-9,4780-5120) == blur-em-radius.html blur-em-radius-ref.html == blur-invalid-radius.html blur-invalid-radius-ref.html -fuzzy-if(webrender,9-9,4780-4784) == blur-rem-radius.html blur-rem-radius-ref.html +fuzzy-if(webrender,9-9,4780-5120) == blur-rem-radius.html blur-rem-radius-ref.html == blur-zero-radius.html blur-zero-radius-ref.html -fuzzy-if(webrender,5-7,19040-21308) == blur-zoomed-page.html blur-zoomed-page-ref.html +fuzzy-if(webrender,5-7,19040-22652) == blur-zoomed-page.html blur-zoomed-page-ref.html == brightness.html brightness-ref.html == brightness-darken.html brightness-darken-ref.html == brightness-extreme.html brightness-extreme-ref.html @@ -24,9 +24,9 @@ fuzzy-if(webrender,5-7,19040-21308) == blur-zoomed-page.html blur-zoomed-page-re == contrast-percent.html contrast-percent-ref.html == contrast-reduce.html contrast-reduce-ref.html == contrast-zero.html contrast-zero-ref.html -fuzzy-if(webrender,9-9,2625-2628) == drop-shadow.html drop-shadow-ref.html -fuzzy-if(webrender,9-9,2625-2628) fails-if(webrender&&winWidget) == drop-shadow-default-color.html drop-shadow-default-color-ref.html -fuzzy-if(webrender,9-9,2625-2628) fails-if(webrender&&winWidget) == drop-shadow-negative-offset.html drop-shadow-negative-offset-ref.html +fuzzy-if(webrender,9-9,2625-3002) == drop-shadow.html drop-shadow-ref.html +fuzzy-if(webrender,9-9,2625-3002) fails-if(webrender&&winWidget) == drop-shadow-default-color.html drop-shadow-default-color-ref.html +fuzzy-if(webrender,9-9,2625-3002) fails-if(webrender&&winWidget) == drop-shadow-negative-offset.html drop-shadow-negative-offset-ref.html == filter-on-huge-bbox.html pass.svg == filter-on-outer-svg.html pass.svg fuzzy-if(webrender,0-1,0-10000) fuzzy-if(d2d,0-1,0-10000) == grayscale.html grayscale-ref.html From 48a77c4938567704f31c016aa2a5c5e5d466e2e0 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Fri, 28 Sep 2018 14:28:54 +1000 Subject: [PATCH 11/11] Bug 1306696 part 4 - Add test for this bug. r=smaug MozReview-Commit-ID: 1Pzt6DPif00 --HG-- extra : source : 8e4d810704a278ea8130d8dc3c38c3173ca92a55 --- dom/html/test/browser.ini | 6 +- dom/html/test/browser_fullscreen-newtab.js | 80 ++++++++++++++++++++++ dom/html/test/file_fullscreen-newtab.html | 4 ++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 dom/html/test/browser_fullscreen-newtab.js create mode 100644 dom/html/test/file_fullscreen-newtab.html diff --git a/dom/html/test/browser.ini b/dom/html/test/browser.ini index 6d5cf40f6a6a..2ca14e118849 100644 --- a/dom/html/test/browser.ini +++ b/dom/html/test/browser.ini @@ -29,7 +29,11 @@ support-files = tags = fullscreen [browser_fullscreen-contextmenu-esc.js] tags = fullscreen +[browser_fullscreen-newtab.js] +tags = fullscreen +support-files = file_fullscreen-newtab.html +skip-if = os == 'mac' # bug 1494843 [browser_submission_flush.js] [browser_refresh_wyciwyg_url.js] support-files = - file_refresh_wyciwyg_url.html \ No newline at end of file + file_refresh_wyciwyg_url.html diff --git a/dom/html/test/browser_fullscreen-newtab.js b/dom/html/test/browser_fullscreen-newtab.js new file mode 100644 index 000000000000..41dee1b1348e --- /dev/null +++ b/dom/html/test/browser_fullscreen-newtab.js @@ -0,0 +1,80 @@ +"use strict"; + +const kPage = "http://example.org/browser/" + + "dom/html/test/file_fullscreen-newtab.html"; + +function getSizeMode() { + return document.documentElement.getAttribute("sizemode"); +} + +async function runTest() { + await BrowserTestUtils.withNewTab({ + gBrowser, + url: kPage + }, async function (browser) { + await ContentTask.spawn(browser, null, function() { + content.document.addEventListener("fullscreenchange", () => { + sendAsyncMessage("Test:FullscreenChange"); + }); + content.document.addEventListener("fullscreenerror", () => { + sendAsyncMessage("Test:FullscreenError"); + }); + }); + let promiseFsEvents = new Promise(resolve => { + let countFsChange = 0; + let countFsError = 0; + function checkAndResolve() { + if (countFsChange > 0 && countFsError > 0) { + ok(false, "Got both fullscreenchange and fullscreenerror events"); + } else if (countFsChange > 2) { + ok(false, "Got too many fullscreenchange events"); + } else if (countFsError > 1) { + ok(false, "Got too many fullscreenerror events"); + } else if (countFsChange == 2 || countFsError == 1) { + resolve(); + } + } + let mm = browser.messageManager; + mm.addMessageListener("Test:FullscreenChange", () => { + info("Got fullscreenchange event"); + ++countFsChange; + checkAndResolve(); + }); + mm.addMessageListener("Test:FullscreenError", () => { + info("Got fullscreenerror event"); + ++countFsError; + checkAndResolve(); + }); + }); + let promiseNewTab = + BrowserTestUtils.waitForNewTab(gBrowser, "about:blank"); + await BrowserTestUtils.synthesizeMouseAtCenter("#link", {}, browser); + let [newtab] = await Promise.all([promiseNewTab, promiseFsEvents]); + await BrowserTestUtils.removeTab(newtab); + + // Ensure the browser exits fullscreen state in reasonable time. + await Promise.race([ + BrowserTestUtils.waitForCondition(() => getSizeMode() == "normal"), + new Promise(resolve => setTimeout(resolve, 2000)) + ]); + + ok(!window.fullScreen, "The chrome window should not be in fullscreen"); + ok(!document.fullscreen, "The chrome document should not be in fullscreen"); + }); +} + +add_task(async function () { + await pushPrefs( + ["full-screen-api.unprefix.enabled", true], + ["full-screen-api.transition-duration.enter", "0 0"], + ["full-screen-api.transition-duration.leave", "0 0"]); + await runTest(); +}); + +add_task(async function () { + await pushPrefs( + ["full-screen-api.unprefix.enabled", true], + ["full-screen-api.transition-duration.enter", "200 200"], + ["full-screen-api.transition-duration.leave", "200 200"]); + await runTest(); +}); diff --git a/dom/html/test/file_fullscreen-newtab.html b/dom/html/test/file_fullscreen-newtab.html new file mode 100644 index 000000000000..96458e934f7d --- /dev/null +++ b/dom/html/test/file_fullscreen-newtab.html @@ -0,0 +1,4 @@ + + +Click here