From 66a3f4b7a1b01f1ffa5d819d7ea3f55adec0dee1 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Wed, 20 Sep 2017 11:47:58 -0700 Subject: [PATCH 01/29] Bug 1401319 - Implement xulRuntime.is64Bit for manifest tests, r=jonco --HG-- extra : rebase_source : cb6a7a12821a5b26ff09aad79b8c628a29f6721e extra : source : 6998422519778a38cfde7e901d05919fde0b023b --- js/src/tests/js1_5/Array/regress-157652.js | 2 +- js/src/tests/js1_5/Regress/regress-422348.js | 2 +- js/src/tests/lib/manifest.py | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/js/src/tests/js1_5/Array/regress-157652.js b/js/src/tests/js1_5/Array/regress-157652.js index 6916fe1790d4..00dca0b9443d 100644 --- a/js/src/tests/js1_5/Array/regress-157652.js +++ b/js/src/tests/js1_5/Array/regress-157652.js @@ -1,4 +1,4 @@ -// |reftest| skip-if(xulRuntime.XPCOMABI.match(/x86_64|aarch64|ppc64|ppc64le|s390x/)||Android) -- No test results +// |reftest| skip-if(xulRuntime.is64Bit||Android) -- No test results /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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 diff --git a/js/src/tests/js1_5/Regress/regress-422348.js b/js/src/tests/js1_5/Regress/regress-422348.js index 7ae83f4a6c8e..c1839b5e1adf 100644 --- a/js/src/tests/js1_5/Regress/regress-422348.js +++ b/js/src/tests/js1_5/Regress/regress-422348.js @@ -1,4 +1,4 @@ -// |reftest| skip-if(xulRuntime.XPCOMABI.match(/x86_64|aarch64|ppc64|ppc64le|s390x/)) -- On 64-bit, takes forever rather than throwing +// |reftest| skip-if(xulRuntime.is64Bit) -- On 64-bit, takes forever rather than throwing /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* 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 diff --git a/js/src/tests/lib/manifest.py b/js/src/tests/lib/manifest.py index 4828736342c3..ced06e096cc1 100644 --- a/js/src/tests/lib/manifest.py +++ b/js/src/tests/lib/manifest.py @@ -21,9 +21,10 @@ def split_path_into_dirs(path): return dirs class XULInfo: - def __init__(self, abi, os, isdebug): + def __init__(self, abi, os, is64Bit, isdebug): self.abi = abi self.os = os + self.is64Bit = is64Bit self.isdebug = isdebug self.browserIsRemote = False @@ -31,11 +32,12 @@ class XULInfo: """Return JS that when executed sets up variables so that JS expression predicates on XUL build info evaluate properly.""" - return ('var xulRuntime = {{ OS: "{}", XPCOMABI: "{}", shell: true }};' + return ('var xulRuntime = {{ OS: "{}", is64Bit: {}, XPCOMABI: "{}", shell: true }};' 'var release_or_beta = getBuildConfiguration().release_or_beta;' 'var isDebugBuild={}; var Android={}; ' 'var browserIsRemote={}'.format( self.os, + "true" if self.is64Bit else "false", self.abi, str(self.isdebug).lower(), str(self.os == "Android").lower(), @@ -64,8 +66,8 @@ class XULInfo: sys.exit(1) # Read the values. - val_re = re.compile(r'(TARGET_XPCOM_ABI|OS_TARGET|MOZ_DEBUG)\s*=\s*(.*)') - kw = {'isdebug': False} + val_re = re.compile(r'(TARGET_XPCOM_ABI|OS_TARGET|MOZ_DEBUG|HAVE_64BIT_BUILD)\s*=\s*(.*)') + kw = {'isdebug': False, 'is64Bit': False} for line in open(path): m = val_re.match(line) if m: @@ -75,6 +77,8 @@ class XULInfo: kw['abi'] = val if key == 'OS_TARGET': kw['os'] = val + if key == 'HAVE_64BIT_BUILD': + kw['is64Bit'] = (val == '1') if key == 'MOZ_DEBUG': kw['isdebug'] = (val == '1') return cls(**kw) From 811aaaffad059e3db18a6ca4276149e1fda5d0c4 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Thu, 21 Sep 2017 09:59:02 -0700 Subject: [PATCH 02/29] Bug 1402504 - Switch to using in-source annotations more directly, r=jonco --HG-- extra : rebase_source : 477173b9c98df724b4a922de5ae7e3bda38cf76e --- js/src/devtools/rootAnalysis/CFG.js | 12 ++- js/src/devtools/rootAnalysis/analyzeRoots.js | 10 +- js/src/devtools/rootAnalysis/annotations.js | 64 ++++++------ .../devtools/rootAnalysis/computeCallgraph.js | 4 +- .../devtools/rootAnalysis/computeGCTypes.js | 97 +++++++++++-------- js/src/devtools/rootAnalysis/dumpCFG.js | 5 +- js/src/devtools/rootAnalysis/utility.js | 8 +- 7 files changed, 118 insertions(+), 82 deletions(-) diff --git a/js/src/devtools/rootAnalysis/CFG.js b/js/src/devtools/rootAnalysis/CFG.js index 6e9facaa1201..97781e1b61a0 100644 --- a/js/src/devtools/rootAnalysis/CFG.js +++ b/js/src/devtools/rootAnalysis/CFG.js @@ -40,6 +40,14 @@ function isMatchingDestructor(constructor, edge) if (variable.Name[1].charAt(0) != '~') return false; + // Note that in some situations, a regular function can begin with '~', so + // we don't necessarily have a destructor in hand. This is probably a + // sixgill artifact, but in js::wasm::ModuleGenerator::~ModuleGenerator, a + // templatized static inline EraseIf is invoked, and it gets named ~EraseIf + // for some reason. + if (!("PEdgeCallInstance" in edge)) + return false; + var constructExp = constructor.PEdgeCallInstance.Exp; assert(constructExp.Kind == "Var"); @@ -55,7 +63,7 @@ function isMatchingDestructor(constructor, edge) // treat each instance separately, such as when different regions of a function // body were guarded by these constructors and you needed to do something // different with each.) -function allRAIIGuardedCallPoints(bodies, body, isConstructor) +function allRAIIGuardedCallPoints(typeInfo, bodies, body, isConstructor) { if (!("PEdge" in body)) return []; @@ -70,7 +78,7 @@ function allRAIIGuardedCallPoints(bodies, body, isConstructor) continue; var variable = callee.Variable; assert(variable.Kind == "Func"); - if (!isConstructor(edge.Type, variable.Name)) + if (!isConstructor(typeInfo, edge.Type, variable.Name)) continue; if (!("PEdgeCallInstance" in edge)) continue; diff --git a/js/src/devtools/rootAnalysis/analyzeRoots.js b/js/src/devtools/rootAnalysis/analyzeRoots.js index 61b46e387a77..0f1913284941 100644 --- a/js/src/devtools/rootAnalysis/analyzeRoots.js +++ b/js/src/devtools/rootAnalysis/analyzeRoots.js @@ -5,6 +5,7 @@ loadRelativeToScript('utility.js'); loadRelativeToScript('annotations.js'); loadRelativeToScript('CFG.js'); +loadRelativeToScript('dumpCFG.js'); var sourceRoot = (os.getenv('SOURCE') || '') + '/' @@ -29,8 +30,6 @@ var batch = (scriptArgs[5]|0) || 1; var numBatches = (scriptArgs[6]|0) || 1; var tmpfile = scriptArgs[7] || "tmp.txt"; -GCSuppressionTypes = loadTypeInfo(typeInfoFile)["Suppress GC"] || []; - var gcFunctions = {}; var text = snarf("gcFunctions.lst").split("\n"); assert(text.pop().length == 0); @@ -45,6 +44,8 @@ for (var line of text) { } text = null; +var typeInfo = loadTypeInfo(typeInfoFile); + var gcEdges = {}; text = snarf(gcEdgesFile).split('\n'); assert(text.pop().length == 0); @@ -749,7 +750,8 @@ function printEntryTrace(functionName, entry) function isRootedType(type) { - return type.Kind == "CSU" && isRootedTypeName(type.Name); + return type.Kind == "CSU" && ((type.Name in typeInfo.RootedPointers) || + (type.Name in typeInfo.RootedGCThings)); } function typeDesc(type) @@ -841,7 +843,7 @@ function process(name, json) { for (var body of functionBodies) body.suppressed = []; for (var body of functionBodies) { - for (var [pbody, id] of allRAIIGuardedCallPoints(functionBodies, body, isSuppressConstructor)) + for (var [pbody, id] of allRAIIGuardedCallPoints(typeInfo, functionBodies, body, isSuppressConstructor)) pbody.suppressed[id] = true; } processBodies(functionName); diff --git a/js/src/devtools/rootAnalysis/annotations.js b/js/src/devtools/rootAnalysis/annotations.js index 6c717992866c..042b58194b51 100644 --- a/js/src/devtools/rootAnalysis/annotations.js +++ b/js/src/devtools/rootAnalysis/annotations.js @@ -2,10 +2,6 @@ "use strict"; -// RAII types within which we should assume GC is suppressed, eg -// AutoSuppressGC. -var GCSuppressionTypes = []; - // Ignore calls made through these function pointers var ignoreIndirectCalls = { "mallocSizeOf" : true, @@ -43,11 +39,20 @@ function indirectCallCannotGC(fullCaller, fullVariable) return true; // template method called during marking and hence cannot GC - if (name == "op" && caller.indexOf("bool js::WeakMap::keyNeedsMark(JSObject*)") != -1) + if (name == "op" && caller.includes("bool js::WeakMap::keyNeedsMark(JSObject*)")) { return true; } + // Call through a 'callback' function pointer, in a place where we're going + // to be throwing a JS exception. + if (name == "callback" && caller.includes("js::ErrorToException")) + return true; + + // The math cache only gets called with non-GC math functions. + if (name == "f" && caller.includes("js::MathCache::lookup")) + return true; + return false; } @@ -218,6 +223,8 @@ var ignoreFunctions = { "uint32 js::TenuringTracer::moveObjectToTenured(JSObject*, JSObject*, int32)" : true, "void js::Nursery::freeMallocedBuffers()" : true, + "void js::AutoEnterOOMUnsafeRegion::crash(uint64, int8*)" : true, + // It would be cool to somehow annotate that nsTHashtable will use // nsTHashtable::s_MatchEntry for its matchEntry function pointer, but // there is no mechanism for that. So we will just annotate a particularly @@ -287,11 +294,11 @@ function ignoreGCFunction(mangled) return true; // Templatized function - if (fun.indexOf("void nsCOMPtr::Assert_NoQueryNeeded()") >= 0) + if (fun.includes("void nsCOMPtr::Assert_NoQueryNeeded()")) return true; // These call through an 'op' function pointer. - if (fun.indexOf("js::WeakMap::getDelegate(") >= 0) + if (fun.includes("js::WeakMap::getDelegate(")) return true; // XXX modify refillFreeList to not need data flow analysis to understand it cannot GC. @@ -307,9 +314,27 @@ function stripUCSAndNamespace(name) return name; } -function isRootedGCTypeName(name) +function extraRootedGCThings() { - return (name == "JSAddonId"); + return [ 'JSAddonId' ]; +} + +function extraRootedPointers() +{ + return [ + 'ModuleValidator', + 'JSErrorResult', + 'WrappableJSErrorResult', + + // These are not actually rooted, but are only used in the context of + // AutoKeepAtoms. + 'js::frontend::TokenStream', + 'js::frontend::TokenStream::Position', + + 'mozilla::ErrorResult', + 'mozilla::IgnoredErrorResult', + 'mozilla::dom::binding_detail::FastErrorResult', + ]; } function isRootedGCPointerTypeName(name) @@ -319,33 +344,16 @@ function isRootedGCPointerTypeName(name) if (name.startsWith('MaybeRooted<')) return /\(js::AllowGC\)1u>::RootType/.test(name); - if (name == "ErrorResult" || - name == "JSErrorResult" || - name == "WrappableJSErrorResult" || - name == "binding_detail::FastErrorResult" || - name == "IgnoredErrorResult" || - name == "frontend::TokenStream" || - name == "frontend::TokenStream::Position" || - name == "ModuleValidator") - { - return true; - } - return name.startsWith('Rooted') || name.startsWith('PersistentRooted'); } -function isRootedTypeName(name) -{ - return isRootedGCTypeName(name) || isRootedGCPointerTypeName(name); -} - function isUnsafeStorage(typeName) { typeName = stripUCSAndNamespace(typeName); return typeName.startsWith('UniquePtr<'); } -function isSuppressConstructor(edgeType, varName) +function isSuppressConstructor(typeInfo, edgeType, varName) { // Check whether this could be a constructor if (edgeType.Kind != 'Function') @@ -357,7 +365,7 @@ function isSuppressConstructor(edgeType, varName) // Check whether the type is a known suppression type. var type = edgeType.TypeFunctionCSU.Type.Name; - if (GCSuppressionTypes.indexOf(type) == -1) + if (!(type in typeInfo.GCSuppressors)) return false; // And now make sure this is the constructor, not some other method on a diff --git a/js/src/devtools/rootAnalysis/computeCallgraph.js b/js/src/devtools/rootAnalysis/computeCallgraph.js index 9e3e931106a8..8d27601de45d 100644 --- a/js/src/devtools/rootAnalysis/computeCallgraph.js +++ b/js/src/devtools/rootAnalysis/computeCallgraph.js @@ -128,7 +128,7 @@ function processBody(functionName, body) } } -GCSuppressionTypes = loadTypeInfo(typeInfo_filename)["Suppress GC"] || []; +var typeInfo = loadTypeInfo(typeInfo_filename); loadTypes("src_comp.xdb"); @@ -155,7 +155,7 @@ function process(functionName, functionBodies) body.suppressed = []; for (var body of functionBodies) { - for (var [pbody, id] of allRAIIGuardedCallPoints(functionBodies, body, isSuppressConstructor)) + for (var [pbody, id] of allRAIIGuardedCallPoints(typeInfo, functionBodies, body, isSuppressConstructor)) pbody.suppressed[id] = true; } diff --git a/js/src/devtools/rootAnalysis/computeGCTypes.js b/js/src/devtools/rootAnalysis/computeGCTypes.js index af4d703896e1..337adfabfed9 100644 --- a/js/src/devtools/rootAnalysis/computeGCTypes.js +++ b/js/src/devtools/rootAnalysis/computeGCTypes.js @@ -8,12 +8,16 @@ loadRelativeToScript('annotations.js'); var gcTypes_filename = scriptArgs[0] || "gcTypes.txt"; var typeInfo_filename = scriptArgs[1] || "typeInfo.txt"; -var annotations = { +var typeInfo = { 'GCPointers': [], 'GCThings': [], 'NonGCTypes': {}, // unused 'NonGCPointers': {}, + 'RootedGCThings': {}, 'RootedPointers': {}, + + // RAII types within which we should assume GC is suppressed, eg + // AutoSuppressGC. 'GCSuppressors': {}, }; @@ -22,6 +26,7 @@ var gDescriptors = new Map; // Map from descriptor string => Set of typeName var structureParents = {}; // Map from field => list of var pointerParents = {}; // Map from field => list of var baseClasses = {}; // Map from struct name => list of base class name strings +var subClasses = {}; // Map from struct name => list of subclass name strings var gcTypes = {}; // map from parent struct => Set of GC typed children var gcPointers = {}; // map from parent struct => Set of GC typed children @@ -61,17 +66,17 @@ function processCSU(csu, body) continue; if (tag == 'GC Pointer') - annotations.GCPointers.push(csu); + typeInfo.GCPointers.push(csu); else if (tag == 'Invalidated by GC') - annotations.GCPointers.push(csu); + typeInfo.GCPointers.push(csu); else if (tag == 'GC Thing') - annotations.GCThings.push(csu); + typeInfo.GCThings.push(csu); else if (tag == 'Suppressed GC Pointer') - annotations.NonGCPointers[csu] = true; + typeInfo.NonGCPointers[csu] = true; else if (tag == 'Rooted Pointer') - annotations.RootedPointers[csu] = true; + typeInfo.RootedPointers[csu] = true; else if (tag == 'Suppress GC') - annotations.GCSuppressors[csu] = true; + typeInfo.GCSuppressors[csu] = true; } } @@ -91,6 +96,9 @@ function addBaseClass(csu, base) { if (!(csu in baseClasses)) baseClasses[csu] = []; baseClasses[csu].push(base); + if (!(base in subClasses)) + subClasses[base] = []; + subClasses[base].push(csu); var k = baseClasses[csu].length; addNestedStructure(csu, base, ``); } @@ -119,22 +127,24 @@ for (var csuIndex = minStream; csuIndex <= maxStream; csuIndex++) { xdb.free_string(data); } +for (const typename of extraRootedGCThings()) + typeInfo.RootedGCThings[typename] = true; + +for (const typename of extraRootedPointers()) + typeInfo.RootedPointers[typename] = true; + // Now that we have the whole hierarchy set up, add all the types and propagate // info. -for (let csu of annotations.GCThings) +for (const csu of typeInfo.GCThings) addGCType(csu); -for (let csu of annotations.GCPointers) +for (const csu of typeInfo.GCPointers) addGCPointer(csu); -function stars(n) { return n ? '*' + stars(n-1) : '' }; - // "typeName is a (pointer to a)^'typePtrLevel' GC type because it contains a field // named 'child' of type 'why' (or pointer to 'why' if fieldPtrLevel == 1), which is // itself a GCThing or GCPointer." function markGCType(typeName, child, why, typePtrLevel, fieldPtrLevel, indent) { - //printErr(`${indent}${typeName}${stars(typePtrLevel)} may be a gctype/ptr because of its child '${child}' of type ${why}${stars(fieldPtrLevel)}`); - // Some types, like UniquePtr, do not mark/trace/relocate their contained // pointers and so should not hold them live across a GC. UniquePtr in // particular should be the only thing pointing to a structure containing a @@ -166,19 +176,22 @@ function markGCType(typeName, child, why, typePtrLevel, fieldPtrLevel, indent) if (ptrLevel > 2) return; - if (ptrLevel == 0 && isRootedGCTypeName(typeName)) + if (isRootedGCPointerTypeName(typeName) && !(typeName in typeInfo.RootedPointers)) + printErr("FIXME: use in-source annotation for " + typeName); + + if (ptrLevel == 0 && (typeName in typeInfo.RootedGCThings)) return; - if (ptrLevel == 1 && isRootedGCPointerTypeName(typeName)) + if (ptrLevel == 1 && (isRootedGCPointerTypeName(typeName) || (typeName in typeInfo.RootedPointers))) return; if (ptrLevel == 0) { - if (typeName in annotations.NonGCTypes) + if (typeName in typeInfo.NonGCTypes) return; if (!(typeName in gcTypes)) gcTypes[typeName] = new Set(); gcTypes[typeName].add(why); } else if (ptrLevel == 1) { - if (typeName in annotations.NonGCPointers) + if (typeName in typeInfo.NonGCPointers) return; if (!(typeName in gcPointers)) gcPointers[typeName] = new Set(); @@ -215,28 +228,34 @@ function addGCPointer(typeName) markGCType(typeName, '', '(annotation)', 1, 0, ""); } -// Add an arbitrary descriptor to a type, and apply it recursively to all base -// structs and structs that contain the given typeName as a field. -function addDescriptor(typeName, descriptor) +// Call a function for a type and every type that contains the type in a field +// or as a base class (which internally is pretty much the same thing -- +// sublcasses are structs beginning with the base class and adding on their +// local fields.) +function foreachContainingStruct(typeName, func, seen = new Set()) { - if (!gDescriptors.has(descriptor)) - gDescriptors.set(descriptor, new Set); - let descriptorTypes = gDescriptors.get(descriptor); - if (!descriptorTypes.has(typeName)) { - descriptorTypes.add(typeName); - if (typeName in structureParents) { - for (let [holder, field] of structureParents[typeName]) - addDescriptor(holder, descriptor); + function recurse(container, typeName) { + if (seen.has(typeName)) + return; + seen.add(typeName); + + func(container, typeName); + + if (typeName in subClasses) { + for (const sub of subClasses[typeName]) + recurse("subclass of " + typeName, sub); } - if (typeName in baseClasses) { - for (let base of baseClasses[typeName]) - addDescriptor(base, descriptor); + if (typeName in structureParents) { + for (const [holder, field] of structureParents[typeName]) + recurse(field + " : " + typeName, holder); } } + + recurse('', typeName); } for (var type of listNonGCPointers()) - annotations.NonGCPointers[type] = true; + typeInfo.NonGCPointers[type] = true; function explain(csu, indent, seen) { if (!seen) @@ -288,12 +307,14 @@ for (var csu in gcPointers) { // Redirect output to the typeInfo file and close the gcTypes file. os.file.close(os.file.redirect(typeInfo_filename)); -for (let csu in annotations.GCSuppressors) - addDescriptor(csu, 'Suppress GC'); +// Compute the set of types that suppress GC within their RAII scopes (eg +// AutoSuppressGC, AutoSuppressGCForAnalysis). +var seen = new Set(); +for (let csu in typeInfo.GCSuppressors) + foreachContainingStruct(csu, + (holder, typeName) => { typeInfo.GCSuppressors[typeName] = holder }, + seen); -for (let [descriptor, types] of gDescriptors) { - for (let csu of types) - print(descriptor + "$$" + csu); -} +print(JSON.stringify(typeInfo, null, 4)); os.file.close(os.file.redirect(origOut)); diff --git a/js/src/devtools/rootAnalysis/dumpCFG.js b/js/src/devtools/rootAnalysis/dumpCFG.js index fb89733f4b19..cecb785a65cf 100644 --- a/js/src/devtools/rootAnalysis/dumpCFG.js +++ b/js/src/devtools/rootAnalysis/dumpCFG.js @@ -241,7 +241,10 @@ function str_edge(edge, env) { } function str(unknown) { - if ("Index" in unknown) { + if ("Name" in unknown) { + return str_Variable(unknown); + } else if ("Index" in unknown) { + // Note: Variable also has .Index, with a different meaning. return str_edge(unknown); } else if ("Kind" in unknown) { if ("BlockId" in unknown) diff --git a/js/src/devtools/rootAnalysis/utility.js b/js/src/devtools/rootAnalysis/utility.js index 71d9a3fa58c2..eb8f8f66ceca 100644 --- a/js/src/devtools/rootAnalysis/utility.js +++ b/js/src/devtools/rootAnalysis/utility.js @@ -267,11 +267,5 @@ function addToKeyedList(collection, key, entry) function loadTypeInfo(filename) { - var info = {}; - for (var line of readFileLines_gen(filename)) { - line = line.replace(/\n/, ""); - let [property, name] = line.split("$$"); - addToKeyedList(info, property, name); - } - return info; + return JSON.parse(os.file.readFile(filename)); } From 997340b49200d54cef1f5796d53d4f9ac193e331 Mon Sep 17 00:00:00 2001 From: Randall Barker Date: Mon, 25 Sep 2017 12:09:49 -0700 Subject: [PATCH 03/29] Bug 1402594 - Fix regression where toolbar does not become visible when link is pressed r=jchen MozReview-Commit-ID: B5ppPaQXo5e --- mobile/android/base/java/org/mozilla/gecko/BrowserApp.java | 1 + 1 file changed, 1 insertion(+) diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java index be9fcdf9f62c..fee84d4093ab 100644 --- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -677,6 +677,7 @@ public class BrowserApp extends GeckoApp }); mProgressView = (AnimatedProgressBar) findViewById(R.id.page_progress); + mDynamicToolbar.setLayerView(mLayerView); mProgressView.setDynamicToolbar(mDynamicToolbar); mBrowserToolbar.setProgressBar(mProgressView); From 117526801f3e6469320d2fc27b22c516aa9e7ee4 Mon Sep 17 00:00:00 2001 From: Towkir Ahmed Date: Fri, 22 Sep 2017 11:52:00 -0400 Subject: [PATCH 04/29] Bug 1363028 - Update bookmark toolbar icons to photon styles. r=johannh --- browser/themes/linux/browser.css | 42 ---------- browser/themes/linux/jar.mn | 2 - browser/themes/linux/places/calendar.png | Bin 670 -> 0 bytes browser/themes/linux/places/query.png | Bin 678 -> 0 bytes browser/themes/osx/browser.css | 77 ------------------ browser/themes/osx/jar.mn | 5 -- browser/themes/osx/page-livemarks@2x.png | Bin 1167 -> 0 bytes browser/themes/osx/places/history.png | Bin 843 -> 0 bytes browser/themes/osx/places/history@2x.png | Bin 1872 -> 0 bytes browser/themes/osx/places/query.png | Bin 549 -> 0 bytes browser/themes/osx/places/query@2x.png | Bin 1055 -> 0 bytes .../themes/shared/toolbarbutton-icons.inc.css | 51 ++++++++++++ browser/themes/windows/browser.css | 54 ------------ browser/themes/windows/jar.mn | 3 - browser/themes/windows/livemark-folder.png | Bin 619 -> 0 bytes browser/themes/windows/places/calendar.png | Bin 567 -> 0 bytes browser/themes/windows/places/query.png | Bin 601 -> 0 bytes 17 files changed, 51 insertions(+), 183 deletions(-) delete mode 100644 browser/themes/linux/places/calendar.png delete mode 100644 browser/themes/linux/places/query.png delete mode 100644 browser/themes/osx/page-livemarks@2x.png delete mode 100644 browser/themes/osx/places/history.png delete mode 100644 browser/themes/osx/places/history@2x.png delete mode 100644 browser/themes/osx/places/query.png delete mode 100644 browser/themes/osx/places/query@2x.png delete mode 100644 browser/themes/windows/livemark-folder.png delete mode 100644 browser/themes/windows/places/calendar.png delete mode 100644 browser/themes/windows/places/query.png diff --git a/browser/themes/linux/browser.css b/browser/themes/linux/browser.css index 34f43182f8ca..a2857dbc31fe 100644 --- a/browser/themes/linux/browser.css +++ b/browser/themes/linux/browser.css @@ -124,48 +124,6 @@ menuitem.bookmark-item { list-style-image: url(chrome://browser/skin/places/toolbarDropMarker.png); } -/* Bookmark items */ -.bookmark-item { - list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.svg"); -} - -.bookmark-item[container] { - list-style-image: url("moz-icon://stock/gtk-directory?size=menu"); -} - -.bookmark-item[container][livemark] { - list-style-image: url("chrome://browser/skin/feeds/feedIcon16.png"); -} - -.bookmark-item[container][livemark] .bookmark-item { - list-style-image: url("chrome://browser/skin/places/livemark-item.png"); - -moz-image-region: rect(0px, 16px, 16px, 0px); -} - -.bookmark-item[container][livemark] .bookmark-item[visited] { - -moz-image-region: rect(0px, 32px, 16px, 16px); -} - -.bookmark-item[container][query] { - list-style-image: url("chrome://browser/skin/places/query.png"); -} - -.bookmark-item[query][tagContainer] { - list-style-image: url("chrome://browser/skin/places/tag.png"); -} - -.bookmark-item[query][dayContainer] { - list-style-image: url("chrome://browser/skin/places/calendar.png"); -} - -.bookmark-item[query][hostContainer] { - list-style-image: url("moz-icon://stock/gtk-directory?size=menu"); -} - -.bookmark-item[query][hostContainer][open] { - list-style-image: url("moz-icon://stock/gtk-directory?size=menu"); -} - .bookmark-item[cutting] > .toolbarbutton-icon, .bookmark-item[cutting] > .menu-iconic-left > .menu-iconic-icon { opacity: 0.5; diff --git a/browser/themes/linux/jar.mn b/browser/themes/linux/jar.mn index e4b0de0923f5..b0fe075ebea5 100644 --- a/browser/themes/linux/jar.mn +++ b/browser/themes/linux/jar.mn @@ -41,14 +41,12 @@ browser.jar: skin/classic/browser/places/bookmarksMenu.png (places/bookmarksMenu.png) skin/classic/browser/places/bookmarksToolbar.png (places/bookmarksToolbar.png) skin/classic/browser/places/bookmarks-menu-arrow.png (places/bookmarks-menu-arrow.png) - skin/classic/browser/places/calendar.png (places/calendar.png) * skin/classic/browser/places/editBookmarkOverlay.css (places/editBookmarkOverlay.css) skin/classic/browser/places/livemark-item.png (places/livemark-item.png) skin/classic/browser/places/starred48.png (places/starred48.png) * skin/classic/browser/places/places.css (places/places.css) skin/classic/browser/places/organizer.css (places/organizer.css) skin/classic/browser/places/organizer.xml (places/organizer.xml) - skin/classic/browser/places/query.png (places/query.png) skin/classic/browser/places/tag.png (places/tag.png) skin/classic/browser/places/toolbarDropMarker.png (places/toolbarDropMarker.png) skin/classic/browser/places/unsortedBookmarks.png (places/unsortedBookmarks.png) diff --git a/browser/themes/linux/places/calendar.png b/browser/themes/linux/places/calendar.png deleted file mode 100644 index f7128685c0dd4e836aab11cbe861c2fb5ec17fde..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 670 zcmV;P0%84$P)(@_}4Kj(apIuo}pTm;4!EW>hAF&kTE6jVge zZPZN!F^Qnd{uD1KLSf-wU|Sy^ot@Lg=5SkCFT6bOb2vOa z?+;Jy`uS734|TJ-vBlqb z@IWxDwT?#z&rVAzWTMCIbr%;u^J(@2xnDU3j-6sJ-q+jj8eER)gaWV@zN{9RoLQk&3CwAKJftu@wKCTCWNUpm5ip-lMXX>?it5k0SnwYDapb_80KWOQnd z79~lglWc8nF*cq+DTTELDIHSjB+_x}1f(u$z*5qN`&W-r(uPPl#{B#OH?H4gd%Hj+ z9K%{mBpkz(%Ybceq0xa-iiszW@cG(FrIT#t^Nfur$Yf?498?7w9fSt@xjS-?&_I8^ zqe20oQGg}~LWnw4Efq(do&JhIY1a^U&tPtP+ z`!5VMq@e%=yw9?i^(W7Rl*+qHYH|zW5|jC%%M*2L2q6K15Rm6bW#^srfDB$rKmrI1 z0pBJDuLEukkTR77!`MJDKQ)3H`BHRtYUf^R&Rhl~WdabsE~KJck>sYE?7OJz8$q#@ zZ7Me6zX(3+Be56&DRGTTp$Sc=ac~->kp;$r?+Hx|5Dm;=*;9+Hu?gK#f$nUi?wSXo zn)!IEg`7rdu2%pNW8+0#b5&TDO1^<_WF*(Dox);>}H zs|y5DCJHlPq?Y_A7g!%tBbX>Wh9Sy_BL4Oji0Ea+3L2`fWH^3O98n%IQpTS`Fp z%?fL>Hd#x5p|G09gX0N)LQotjXFWAgUV7#qu$f)Q-;w-V$9B5P1vK ze8nZvCH~uQfyuw3;`n71X@yRtT$mH=Y}Vi{(IsoPeE}x>6O~Io@6@mid7(JH=y>Eo zU6Tui6=VEBxn|~MM|9-{j(+T9ru^Q!JCm)&5X&8yuj*+DlkWioZNu| zhsJk5T3{MbG429f?!Owedr@39Ce}_zc0`w~3aV9`5s6CtYJla-IPLwuxEq zfE(|fn({2!5nZx8xB`ss^e7i|WaMu}XAL7FwHq;MEiiPd^grT3Prn;+G!~g|#_a|x zn{fr7DN~&xJEBXLy+sccHbzjoe}dk%z6wI@bo%fQP$Orto#g zE_BJ+jk+n%k{!_{OShDRiO(J3wx`=Q9(1_qU+Uo={_5hht;s#O|BHjqzWQF_vzQDM zy89;9{h)VDb(ZXiE_pSm9L%0+vZ2K= zv9`0vh456(S+XO#5VFabvDgeq9eLw$y?XKY)cv9Htx1*tc~uXpV&KGK=f~N?jPAkKS=cqeYW!1 z%CLLvnXYZXhIcKRvqVR9$;)qC2NRMw$oWTG=aTG*E_rFwH87iEtq9(4!>UNjTw)F0 z5?!)5@M{0!*Gusv(6*WQ_#NBryYZ^oH?S1*i8gzE{Eo(wXBIAcj(U;uoo6pl&$A0G hpq`}`&9jB9{RcDB(eT=9a9;ob002ovPDHLkV1f)$HIe`T diff --git a/browser/themes/osx/places/history.png b/browser/themes/osx/places/history.png deleted file mode 100644 index e5a00b56d38ca5af9b9d912e6ee2121ebfc90bbf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 843 zcmV-R1GM~!P)38akRU{e6rLeC%U!#y zKM!8y75gEsK+&gQn4Kddfyt@Vz0f~20()rK z-P1e97v->70#VM(gM&l!q1_H*X$!7q1viR46b%xojEn@5Bb_jsy?ra_XXh-*{EPzD zvy7~AilW?$%SMp4%E4}TfCt5dx9>{NV}#71Mgi+46D+T+dg4r$k1a z!FhZFCm!zwNY1#r#%Oje7Wk$6ZHr3ay@Ve*bo=s<#JE^qIIMZ7?!&20jS zG1mpsHU(^MZNcpPJk1lPe}BY@xW!zgc%I;?SRzx7P3U|>W8>tApuV9A#LY5>di;NN zpBC0|^NcI2zRC~P+9#2*ygPUAU11F3lKK8fTFsX_rAFKD9T*;g=@|pe;5{(R&%^5a zI$sy`B*Cd&R+Q(HIPrszD-^!3vNL&J2pN^^)g zJvT)lejFane-IcHaQQW!6T?lp8J)lj!wo76i;Dk>tJQKMVk@yQi5<$hP1^on{|{sR V@W4oA(0l*@002ovPDHLkV1m;SkPrX> diff --git a/browser/themes/osx/places/history@2x.png b/browser/themes/osx/places/history@2x.png deleted file mode 100644 index 684b374ff5732cfa75ec8d81201874eaaef679a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1872 zcmV-W2e0^vP) zQITbaeHjKAMNniB6l6d^0Rd&$Mg~vM|E8Zx1O=JoA3p9q=l8$M`R?425z%`U5FGY3 zYd6b>by(7gQ)m34H`@?{SmdmS{T}1cFIe_0-(%qse#NDl_`d#!I+MvXvb?;!ME`&A zj5hQk2C>LNE*KjgfPc`jEv)S<-_YYH{cqoCFE*RaGqlbRVv&PfFu($HJp+LGN31_t zM{@ECqUPr2#wGBQ#X<{O5F>q%n^$l(8Z0oue&+y=28L{5{l)UD z*EM8G%M9?d=QA`p{fzGQ-lv+ndb(D4ow9RsDK{^lii%6nhCaj~7CF-PSik}kYOmI2W4jGP<%onB_&^^Y<|9S^%`Bda+NZ(veAY< z#2^+qB6n#?%;6=NV8dh80dUoP$@0(4&W*vS7Zw+3Y~m>mk3OctqGF1RPXJuZl=qkJ z_x005;~@1t9H5^256~w1vN#5@$U*Md_ymCkCfM+R*INVNO>ztgJ$`I#3Bc|V1NZC*zkbYiUIf@ z4g7``)N-p;Yc{{2q2Uo4ExS|a)h(!+XI~ZUICfMv@f){(*iUAxx;{ORNxKvY?H8nj=y$|}to?c8zrTl^` z*ke)IT#yW3UZJS-(G(pM`&K(*k%Qay6<1REaOvhpnU41u@I$M@*>tgr`t{jCV- z;yu*y@|};4p&K__L=i16E@EbH>G+8g6c!e~Y9Dft%iD@Uf+^VWfEPUBE%WyE`;`?w zJUlvnx1)=oYlTH()V=&(PfbnZRa#YEUf!hkIJ9Oza__TY>ZLTnl=$$1C%k1|hmTmX zP7DkVF17Ki1YJr?r$R0s?BmRgiC(-|T2*p|BiZh^TeBazU|cUM7EFl`FL=UR=IP^W z9}pCBx}&R`Zt`+L7m|{xvbu&wpN!FrX%?p%Yf)%^Vd0hb?A=E@{@5x0THDx?!qJI5 zc~!!~!zm&00##I2iQ=oStrJX%4=;GaTjuF~_+UU_@L2=zcaz};B$BIm0FQY9;}cKU zl$W=U7{IRGR-q-R_fOoT3gOV1L+#{;vCSFmE%}NF@BJct1Yhp zOE4uqyx<9MaTKf6hg_Uhp7BMcnz^!yN(6}_jEsz;*0$TI1)j~54GDYScKZ&m$v~I0vhn)x;n695tF22Ia7SmCD7?#= zS%M{T;Q=r9-1d3^D)knnO6{j`Ri_r0YG*2|Yl+1(Xs6_hsg#_YB4#sS9K_7lG)5m{ za5qRvO`{~_@w3EZwn^@yPK6gdSKJ4bZth>no!nxBLnBIRYU`J4>QJ!_JdHB!E4nknTt}j(@yS^ z92pbe+|bxakiMyjdU|_F&(GKn94NSGU|*Y>4cy*D6}-1NbP_KlAqKG`r?I)2Bo3Hh z!(+`mp{vqutE010Y3tye5)+qbXg1tfHr%*L5b9vSXrwkSN{zORa(ECpE7H?5C_ldd zZ75j8h*&AF$zXU17MRR-g~vOuGFZhL)B&e$AG}uSjEMNRqp#vY|KI5QA9cAa@f#PT$sV zyX-#OW$mziw~d268+h-rl?Ot2MjQGNvk|83^B;F^Mq8lGF#ZE_Rn=mqA|HqV0000< KMNUMnLSTa2xs%oa diff --git a/browser/themes/osx/places/query.png b/browser/themes/osx/places/query.png deleted file mode 100644 index 0ccb8470256d32b201cfb508c7276310b7d7e46b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 549 zcmV+=0^0qFP)VcTu7QO&a2r zxOmhfk~VRXN+c4FPENw1{tE{O4*miT#LY!qaB}EPQ0m|&LDNW6>bcs^?#}F*N4r~T zQ^F>*nfbooe81;NmSw?zK85|l^BY@);DusBmX+yAng<8W>+ib=c#WwQ>gdg@=CaboSGR1D07`d`MRyI?FM-Y>BlT+8nKN` z(*l=Eg7cFkKL^HIZOjh6%H`C+&`mHj6GS~MI6k@uNs^$W%fqq5y<1@2nw;*Y#T6o! zSyV)w3TV0$K~HZJAcR4#7GB!A>cQ<+027lgVM9!j2Di|tabX?o-$42)1K1!iIO64t z?HR_nf*r~kP6W9e1BG;ZX9Hl}f{cM7aj$YLqhgywIg+0f$q_)v5$N}OAr?(hLkw3J zDLXB9tpY=SAH2RG5xT2bfU4^GE<7Yucur?&&Q-Q(ja%jz<78RXMUsk&$Z}$xC=lZl zoxBT|=OTj9fRA?}mCOLaq;!;-cf&AkFcJUYv(h)v%+K+=cP?D+-Eo0v?6~}_URQnx nb+wJaGHGY~KfdPdmjD9*$A{ukNh|z>00000NkvXXu0mjfQMC8L diff --git a/browser/themes/osx/places/query@2x.png b/browser/themes/osx/places/query@2x.png deleted file mode 100644 index 20b458aaca5ec3f06510c9d12ea1ffb70a48fe67..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1055 zcmV+)1mOFLP)j^kjC$jL@b!64@}7{iFDr9^7oWG!d(Ly7&$ov(L1Q(v z?JEDP09s<5Kn^SuuRqlQQl2~i5HCH=0AQk>^N*$0nNUJ35YPU{00B*2-fR2`CK8%| zEa8qhI2|$WXCi$5Nnp3eVhCu7^#dPxQBu^3CeKh#G}I>X$^J&rxhI01?ABQHfpr2V zT`P_si=)Y%&Kd6Ka|a5%TZWzN<^W)R`hFdY^MCIM>{7fk0B!6f8v~pNbL+d`@$K|) zn7aNDlVfY!0?%d#yA-bsaC7RBU}AJNXWo9Rh}p^+>B$IiWAc$;d}LLX6YdxSzG3;U zEA%q*z4gmMxa-54&5#}$z)TNjdg7sA?An8@GzCK(BMd zb+nE4T+r^VfVZJXZI1K^uLw|d4$L>>Yl5%S_p{Q`HV&iyBDidR!Y4`w8N zUoaTIn?e4&4w#D1&~-=Ys*@-w_Mta2EBE`TrZwK<9`5Bc*=9+P;*|lerS1s^F5k&u zVsuSlFAvgH_oLL>4zsZt;fpiq4*keAuhHHW>S>q#S!OAo4FPn1FzMuqARb#%rLHE1 zO1l7h-6{IXxfrg+TE*cWG}QHNHbZ(8F9q;{NhR(IE=Lx!;;D<{;}1P>lt*yH7KOd6 z8@AFehHIA7UYL5^_`;h~nDdtA3>bgQ3<9TrMzi~eZG|1| zQoNet!qz{HRO|-i{!63HuPoRyJhvzB1>zOr)g9(#;zbVd4DmdXx5MmV Z_rJhNzO~NC{we?f002ovPDHLkV1l@m15*G1 diff --git a/browser/themes/shared/toolbarbutton-icons.inc.css b/browser/themes/shared/toolbarbutton-icons.inc.css index ec21d06f17dc..904db14a7b3c 100644 --- a/browser/themes/shared/toolbarbutton-icons.inc.css +++ b/browser/themes/shared/toolbarbutton-icons.inc.css @@ -521,3 +521,54 @@ toolbar[brighttext] { animation-duration: 2s; animation-timing-function: ease-out; } + +/* ----- BOOKMARK BUTTONS ----- */ + +.bookmark-item { + list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.svg"); + -moz-context-properties: fill; + fill: currentColor; +} + +.bookmark-item[container] { + list-style-image: url("chrome://browser/skin/places/folder.svg"); +} + +.bookmark-item[container][livemark] { + list-style-image: url("chrome://browser/skin/places/folder-live.svg"); +} + +.bookmark-item[container][livemark] .bookmark-item { + list-style-image: url("chrome://browser/skin/places/livemark-item.png"); + -moz-image-region: rect(0px, 16px, 16px, 0px); +} + +.bookmark-item[container][livemark] .bookmark-item[visited] { + -moz-image-region: rect(0px, 32px, 16px, 16px); +} + +.bookmark-item[container][query] { + list-style-image: url("chrome://browser/skin/places/folder-smart.svg"); +} + +.bookmark-item[query][tagContainer] { + list-style-image: url("chrome://browser/skin/places/tag.png"); + -moz-image-region: auto; +} + +.bookmark-item[query][dayContainer] { + list-style-image: url("chrome://browser/skin/places/history.svg"); + -moz-image-region: auto; +} + +.bookmark-item[query][hostContainer] { + list-style-image: url("chrome://browser/skin/places/folder.svg"); +} + +%ifdef XP_MACOSX +@media (min-resolution: 2dppx) { + .bookmark-item[query][tagContainer] { + list-style-image: url("chrome://browser/skin/places/tag@2x.png"); + } +} +%endif diff --git a/browser/themes/windows/browser.css b/browser/themes/windows/browser.css index 1999ec16fa4a..a96d2420efa3 100644 --- a/browser/themes/windows/browser.css +++ b/browser/themes/windows/browser.css @@ -340,60 +340,6 @@ menuitem.bookmark-item { padding-inline-start: 0px; } -/* ::::: bookmark items ::::: */ - -.bookmark-item { - list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.svg"); -} - -.bookmark-item[container] { - list-style-image: url("chrome://global/skin/icons/folder-item.png"); - -moz-image-region: rect(0px, 32px, 16px, 16px); -} - -.bookmark-item[container][open] { - -moz-image-region: rect(16px, 32px, 32px, 16px); -} - -.bookmark-item[container][livemark] { - list-style-image: url("chrome://browser/skin/livemark-folder.png"); - -moz-image-region: auto; -} - -.bookmark-item[container][livemark] .bookmark-item { - list-style-image: url("chrome://browser/skin/places/livemark-item.png"); - -moz-image-region: rect(0px, 16px, 16px, 0px); -} - -.bookmark-item[container][livemark] .bookmark-item[visited] { - -moz-image-region: rect(0px, 32px, 16px, 16px); -} - -.bookmark-item[container][query] { - list-style-image: url("chrome://browser/skin/places/query.png"); - -moz-image-region: auto; -} - -.bookmark-item[query][tagContainer] { - list-style-image: url("chrome://browser/skin/places/tag.png"); - -moz-image-region: auto; -} - -.bookmark-item[query][dayContainer] { - list-style-image: url("chrome://browser/skin/places/calendar.png"); - -moz-image-region: auto; -} - -.bookmark-item[query][hostContainer] { - list-style-image: url("chrome://global/skin/icons/folder-item.png"); - -moz-image-region: rect(0px, 32px, 16px, 16px); -} - -.bookmark-item[query][hostContainer][open] { - list-style-image: url("chrome://global/skin/icons/folder-item.png"); - -moz-image-region: rect(16px, 32px, 32px, 16px); -} - .bookmark-item[cutting] > .toolbarbutton-icon, .bookmark-item[cutting] > .menu-iconic-left > .menu-iconic-icon { opacity: 0.5; diff --git a/browser/themes/windows/jar.mn b/browser/themes/windows/jar.mn index 1edff722440e..11f7b9c82a70 100644 --- a/browser/themes/windows/jar.mn +++ b/browser/themes/windows/jar.mn @@ -10,7 +10,6 @@ browser.jar: * skin/classic/browser/syncedtabs/sidebar.css (syncedtabs/sidebar.css) * skin/classic/browser/browser.css * skin/classic/browser/compacttheme.css - skin/classic/browser/livemark-folder.png skin/classic/browser/menuPanel-customize.png skin/classic/browser/menuPanel-customize@2x.png skin/classic/browser/menuPanel-exit.png @@ -42,10 +41,8 @@ browser.jar: skin/classic/browser/notification-icons/geo.svg (notification-icons/geo.svg) * skin/classic/browser/places/places.css (places/places.css) * skin/classic/browser/places/organizer.css (places/organizer.css) - skin/classic/browser/places/query.png (places/query.png) skin/classic/browser/places/bookmarksMenu.png (places/bookmarksMenu.png) skin/classic/browser/places/bookmarksToolbar.png (places/bookmarksToolbar.png) - skin/classic/browser/places/calendar.png (places/calendar.png) skin/classic/browser/places/toolbarDropMarker.png (places/toolbarDropMarker.png) skin/classic/browser/places/editBookmarkOverlay.css (places/editBookmarkOverlay.css) skin/classic/browser/places/libraryToolbar.png (places/libraryToolbar.png) diff --git a/browser/themes/windows/livemark-folder.png b/browser/themes/windows/livemark-folder.png deleted file mode 100644 index 0be774e636aa662e5ed9f542030d1abf1aac1d3b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 619 zcmV-x0+juUP)Vl{|H zY%X6K5#jTji(7pFou4b(eU`>!wNxgCnCiR7?8iZ@$zZjEm@KK-6rSJCjJ>|lT?A-v zQLB14!CjY$oPWiM&UWZ zQIN^T-HdOEVpAj*eh^z)MK#~2rKOgc!2y!hN2!YhiGP`(C@)j|NLCP&;ah(%<*eeI z?4))_2m60M;otl;p-?@c#qYr0BEb4O5UkB{r0p<`4b_ArJIQXTAzT3_zC=P-Q5{TB zP)-}Hl{J3{Hj8Pvila7Bp8exK-&*u3+cJv?3Te6m@o@k~hDVn-R|IbXC=p@sMRdey z+d>H{D^ufvKp@)D^)@CV9zZEo15^RQ5*QAU1kxgs`VVSwVwKedhq(X%002ovPDHLk FV1hDX8N~nq diff --git a/browser/themes/windows/places/calendar.png b/browser/themes/windows/places/calendar.png deleted file mode 100644 index 4127e59880945cc3d5ff68fd278615e0c385125e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 567 zcmV-70?7S|P)BK^(HY+f<|rhZ z&1NwGvm=e8SfOGm5PwSI_lDr-2Jvg176W>Qd!^WSdd?~ptzHMwwp99J^xj<*RXv5@ z(D+nE{l%!EWDM*l09rS0dX@UqD;;NugI8M6Oc6rxI6x8ugM-+PWCwO^g~m$($<@@& z_Y*s}SyVh5dzlna#KH5KPIOPa)BS;4-S3XCeOScR_lsV9>Fok8%*-3EC=e2rv7LQY z1nU$;>ZQ`KsN?05u>EENZjKOJoov)0`3P?x+7*f19~|CeF@1l0Y;PV#L54JfG5KPy zfBc44=c^}NHmMiiEI=1JCJ4dhoqs)#(!i798ct1p_Qc7N znn|7oym%kped;={4-J8oL{O66b%iv7#Gcjmolb$O$-fcG(hDYrO={l!q{)_y$E|ak z+dEeXvVy>X@v(=#6b5slV`0RSu*IsYMDj#X#IFBie*w99j1f5OP1a(8OP!R=O9E7kVL?>4hXa59OqluHV8dr!CDA8yFF@c2W zLa;0l=uME7U$# zN$~2}Mh6nb1QwI*M~$zcC=nrW(GtK-KR$boXKG&wWF@>-6Okx_<+ zNBNT7;N9FDqKcU@@$_x`e=|@6QDr5+&8>lJbak8~5=9N(&oA(GyF{g2B4}z^9e*Uhr8hq@)3ERaYxqOb^ zbeh!VF4linkZKpqNHzzJjds$wg=Dgod*gQ?I7Xoq#UBAVSglj5t49tqEgd3IDxyT* zF)I5;qB*ElSyXFntj?$TkH3PJ#C-tI%ouz8>VvBEALST5KbZG@|Mr_l<3GbNj0qBn n#A%=n2#&z<7ubuhIV}GJTuEr78E^BV00000NkvXXu0mjfQkMyv From 6321dc4d1a7c4ff6381c3d338c13fe12cd75c33b Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Mon, 25 Sep 2017 13:07:45 -0500 Subject: [PATCH 05/29] Bug 1401561 - Avoid prompting about compatibility issues with JAWS when e10s is pref'd off. r=jaws MozReview-Commit-ID: 2ejZ7Ga2lLk --- browser/components/nsBrowserGlue.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index cd786acf81f1..9f1ab475f628 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -2850,8 +2850,10 @@ var JawsScreenReaderVersionCheck = { }, _checkVersionAndPrompt() { - // This executes a JAWS version check. - if (!Services.appinfo.shouldBlockIncompatJaws) { + // Make sure we only prompt for versions of JAWS we do not + // support and never prompt if e10s is disabled. + if (!Services.appinfo.shouldBlockIncompatJaws || + !Services.appinfo.browserTabsRemoteAutostart) { return; } From f7588f7e26f765a07ea5c0dbd0256389932d9557 Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Wed, 30 Aug 2017 11:50:00 -0400 Subject: [PATCH 06/29] Bug 1395276 - Make $ and $$ console commands throw errors created in the debuggee global. r=jimb --- devtools/server/actors/webconsole/utils.js | 15 +++++++++++-- .../test/test_jsterm_queryselector.html | 22 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/devtools/server/actors/webconsole/utils.js b/devtools/server/actors/webconsole/utils.js index 8e99efef1025..d88085215533 100644 --- a/devtools/server/actors/webconsole/utils.js +++ b/devtools/server/actors/webconsole/utils.js @@ -308,7 +308,12 @@ exports.WebConsoleCommands = WebConsoleCommands; * The result of calling document.querySelector(selector). */ WebConsoleCommands._registerOriginal("$", function (owner, selector) { - return owner.window.document.querySelector(selector); + try { + return owner.window.document.querySelector(selector); + } catch (err) { + // Throw an error like `err` but that belongs to `owner.window`. + throw new owner.window.DOMException(err.message, err.name); + } }); /** @@ -320,7 +325,13 @@ WebConsoleCommands._registerOriginal("$", function (owner, selector) { * Returns the result of document.querySelectorAll(selector). */ WebConsoleCommands._registerOriginal("$$", function (owner, selector) { - let nodes = owner.window.document.querySelectorAll(selector); + let nodes; + try { + nodes = owner.window.document.querySelectorAll(selector); + } catch (err) { + // Throw an error like `err` but that belongs to `owner.window`. + throw new owner.window.DOMException(err.message, err.name); + } // Calling owner.window.Array.from() doesn't work without accessing the // wrappedJSObject, so just loop through the results instead. diff --git a/devtools/shared/webconsole/test/test_jsterm_queryselector.html b/devtools/shared/webconsole/test/test_jsterm_queryselector.html index fe2df25c9483..0528e1db610f 100644 --- a/devtools/shared/webconsole/test/test_jsterm_queryselector.html +++ b/devtools/shared/webconsole/test/test_jsterm_queryselector.html @@ -34,6 +34,7 @@ function startTest() { checkQuerySelector, checkQuerySelectorAll, checkQuerySelectorAllNotExist, + checkQuerySelectorException, checkQuerySelectorAllException ]; runTests(tests, testEnd); @@ -87,6 +88,25 @@ let checkQuerySelectorAllNotExist = Task.async(function*() { nextTest(); }); +let checkQuerySelectorException = Task.async(function*() { + info ("$ returns an exception if an invalid selector was provided"); + let response = yield evaluateJS("$(':foo')"); + checkObject(response, { + input: "$(':foo')", + exceptionMessage: "SyntaxError: ':foo' is not a valid selector", + exception: { + type: "object", + class: "DOMException", + preview: { + kind: "DOMException", + name: "SyntaxError", + message: "':foo' is not a valid selector" + } + } + }); + nextTest(); +}); + let checkQuerySelectorAllException = Task.async(function*() { info ("$$ returns an exception if an invalid selector was provided"); let response = yield evaluateJS("$$(':foo')"); @@ -94,6 +114,8 @@ let checkQuerySelectorAllException = Task.async(function*() { input: "$$(':foo')", exceptionMessage: "SyntaxError: ':foo' is not a valid selector", exception: { + type: "object", + class: "DOMException", preview: { kind: "DOMException", name: "SyntaxError", From 60f43f2bbd78329c8dc6727c0e4111736cd2fd3d Mon Sep 17 00:00:00 2001 From: Jessica Jong Date: Mon, 25 Sep 2017 02:46:00 -0400 Subject: [PATCH 07/29] Bug 1392970 - Part 1: Make CustomElementDefinition ref-counted and put it in CustomElementData. r=smaug MozReview-Commit-ID: DIQN3JFxkT8 --- dom/base/CustomElementRegistry.cpp | 110 +++++++++++++++++------------ dom/base/CustomElementRegistry.h | 27 ++++++- dom/base/Element.cpp | 20 ++++++ dom/base/Element.h | 16 +++++ dom/base/FragmentOrElement.cpp | 14 +++- dom/base/nsDocument.cpp | 5 +- dom/bindings/BindingUtils.cpp | 2 + 7 files changed, 144 insertions(+), 50 deletions(-) diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index 727704286554..037ca52321b5 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -158,46 +158,15 @@ private: NS_IMPL_CYCLE_COLLECTION_CLASS(CustomElementRegistry) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CustomElementRegistry) - tmp->mCustomDefinitions.Clear(); tmp->mConstructors.clear(); + NS_IMPL_CYCLE_COLLECTION_UNLINK(mCustomDefinitions) NS_IMPL_CYCLE_COLLECTION_UNLINK(mWhenDefinedPromiseMap) NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow) NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(CustomElementRegistry) - for (auto iter = tmp->mCustomDefinitions.Iter(); !iter.Done(); iter.Next()) { - auto& callbacks = iter.UserData()->mCallbacks; - - if (callbacks->mAttributeChangedCallback.WasPassed()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, - "mCustomDefinitions->mCallbacks->mAttributeChangedCallback"); - cb.NoteXPCOMChild(callbacks->mAttributeChangedCallback.Value()); - } - - if (callbacks->mCreatedCallback.WasPassed()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, - "mCustomDefinitions->mCallbacks->mCreatedCallback"); - cb.NoteXPCOMChild(callbacks->mCreatedCallback.Value()); - } - - if (callbacks->mAttachedCallback.WasPassed()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, - "mCustomDefinitions->mCallbacks->mAttachedCallback"); - cb.NoteXPCOMChild(callbacks->mAttachedCallback.Value()); - } - - if (callbacks->mDetachedCallback.WasPassed()) { - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, - "mCustomDefinitions->mCallbacks->mDetachedCallback"); - cb.NoteXPCOMChild(callbacks->mDetachedCallback.Value()); - } - - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, - "mCustomDefinitions->mConstructor"); - cb.NoteXPCOMChild(iter.UserData()->mConstructor); - } - + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCustomDefinitions) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWhenDefinedPromiseMap) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END @@ -248,7 +217,7 @@ CustomElementRegistry::LookupCustomElementDefinition(const nsAString& aLocalName nsCOMPtr localNameAtom = NS_Atomize(aLocalName); nsCOMPtr typeAtom = aIs ? NS_Atomize(*aIs) : localNameAtom; - CustomElementDefinition* data = mCustomDefinitions.Get(typeAtom); + CustomElementDefinition* data = mCustomDefinitions.GetWeak(typeAtom); if (data && data->mLocalName == localNameAtom) { return data; } @@ -267,7 +236,7 @@ CustomElementRegistry::LookupCustomElementDefinition(JSContext* aCx, return nullptr; } - CustomElementDefinition* definition = mCustomDefinitions.Get(ptr->value()); + CustomElementDefinition* definition = mCustomDefinitions.GetWeak(ptr->value()); MOZ_ASSERT(definition, "Definition must be found in mCustomDefinitions"); return definition; @@ -286,7 +255,7 @@ CustomElementRegistry::RegisterUnresolvedElement(Element* aElement, nsIAtom* aTy typeName = info->NameAtom(); } - if (mCustomDefinitions.Get(typeName)) { + if (mCustomDefinitions.GetWeak(typeName)) { return; } @@ -358,7 +327,7 @@ CustomElementRegistry::CreateCustomElementCallback( nsCOMPtr typeAtom = elementData ? elementData->mType.get() : info->NameAtom(); - definition = mCustomDefinitions.Get(typeAtom); + definition = mCustomDefinitions.GetWeak(typeAtom); if (!definition || definition->mLocalName != info->NameAtom()) { // Trying to enqueue a callback for an element that is not // a custom element. We are done, nothing to do. @@ -458,7 +427,7 @@ CustomElementRegistry::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType nsCOMPtr typeAtom = elementData ? elementData->mType.get() : info->NameAtom(); - definition = mCustomDefinitions.Get(typeAtom); + definition = mCustomDefinitions.GetWeak(typeAtom); if (!definition || definition->mLocalName != info->NameAtom()) { return; } @@ -493,7 +462,8 @@ void CustomElementRegistry::GetCustomPrototype(nsIAtom* aAtom, JS::MutableHandle aPrototype) { - mozilla::dom::CustomElementDefinition* definition = mCustomDefinitions.Get(aAtom); + mozilla::dom::CustomElementDefinition* definition = + mCustomDefinitions.GetWeak(aAtom); if (definition) { aPrototype.set(definition->mPrototype); } else { @@ -631,7 +601,7 @@ CustomElementRegistry::Define(const nsAString& aName, * 3. If this CustomElementRegistry contains an entry with name name, then * throw a "NotSupportedError" DOMException and abort these steps. */ - if (mCustomDefinitions.Get(nameAtom)) { + if (mCustomDefinitions.GetWeak(nameAtom)) { aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR); return; } @@ -642,7 +612,7 @@ CustomElementRegistry::Define(const nsAString& aName, */ const auto& ptr = mConstructors.lookup(constructorUnwrapped); if (ptr) { - MOZ_ASSERT(mCustomDefinitions.Get(ptr->value()), + MOZ_ASSERT(mCustomDefinitions.GetWeak(ptr->value()), "Definition must be found in mCustomDefinitions"); aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR); return; @@ -834,7 +804,7 @@ CustomElementRegistry::Define(const nsAString& aName, return; } - CustomElementDefinition* definition = + RefPtr definition = new CustomElementDefinition(nameAtom, localNameAtom, &aFunctionConstructor, @@ -843,7 +813,8 @@ CustomElementRegistry::Define(const nsAString& aName, callbacks, 0 /* TODO dependent on HTML imports. Bug 877072 */); - mCustomDefinitions.Put(nameAtom, definition); + CustomElementDefinition* def = definition.get(); + mCustomDefinitions.Put(nameAtom, definition.forget()); MOZ_ASSERT(mCustomDefinitions.Count() == mConstructors.count(), "Number of entries should be the same"); @@ -851,7 +822,7 @@ CustomElementRegistry::Define(const nsAString& aName, /** * 13. 14. 15. Upgrade candidates */ - UpgradeCandidates(nameAtom, definition, aRv); + UpgradeCandidates(nameAtom, def, aRv); /** * 16. If this CustomElementRegistry's when-defined promise map contains an @@ -874,7 +845,7 @@ CustomElementRegistry::Get(JSContext* aCx, const nsAString& aName, JS::MutableHandle aRetVal) { nsCOMPtr nameAtom(NS_Atomize(aName)); - CustomElementDefinition* data = mCustomDefinitions.Get(nameAtom); + CustomElementDefinition* data = mCustomDefinitions.GetWeak(nameAtom); if (!data) { aRetVal.setUndefined(); @@ -900,7 +871,7 @@ CustomElementRegistry::WhenDefined(const nsAString& aName, ErrorResult& aRv) return promise.forget(); } - if (mCustomDefinitions.Get(nameAtom)) { + if (mCustomDefinitions.GetWeak(nameAtom)) { promise->MaybeResolve(JS::UndefinedHandleValue); return promise.forget(); } @@ -1004,6 +975,9 @@ CustomElementRegistry::Upgrade(Element* aElement, // Step 8. data->mState = CustomElementData::State::eCustom; + // Step 9. + aElement->SetCustomElementDefinition(aDefinition); + // This is for old spec. nsContentUtils::EnqueueLifecycleCallback(aElement->OwnerDoc(), nsIDocument::eCreated, @@ -1156,6 +1130,50 @@ CustomElementReactionsStack::InvokeReactions(ElementQueue* aElementQueue, //----------------------------------------------------- // CustomElementDefinition +NS_IMPL_CYCLE_COLLECTION_CLASS(CustomElementDefinition) + +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CustomElementDefinition) + NS_IMPL_CYCLE_COLLECTION_UNLINK(mConstructor) + tmp->mPrototype = nullptr; + tmp->mCallbacks = nullptr; +NS_IMPL_CYCLE_COLLECTION_UNLINK_END + +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(CustomElementDefinition) + mozilla::dom::LifecycleCallbacks* callbacks = tmp->mCallbacks.get(); + + if (callbacks->mAttributeChangedCallback.WasPassed()) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, + "mCallbacks->mAttributeChangedCallback"); + cb.NoteXPCOMChild(callbacks->mAttributeChangedCallback.Value()); + } + + if (callbacks->mCreatedCallback.WasPassed()) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mCallbacks->mCreatedCallback"); + cb.NoteXPCOMChild(callbacks->mCreatedCallback.Value()); + } + + if (callbacks->mAttachedCallback.WasPassed()) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mCallbacks->mAttachedCallback"); + cb.NoteXPCOMChild(callbacks->mAttachedCallback.Value()); + } + + if (callbacks->mDetachedCallback.WasPassed()) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mCallbacks->mDetachedCallback"); + cb.NoteXPCOMChild(callbacks->mDetachedCallback.Value()); + } + + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mConstructor"); + cb.NoteXPCOMChild(tmp->mConstructor); +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END + +NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(CustomElementDefinition) + NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mPrototype) +NS_IMPL_CYCLE_COLLECTION_TRACE_END + +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(CustomElementDefinition, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(CustomElementDefinition, Release) + + CustomElementDefinition::CustomElementDefinition(nsIAtom* aType, nsIAtom* aLocalName, Function* aConstructor, diff --git a/dom/base/CustomElementRegistry.h b/dom/base/CustomElementRegistry.h index bf8c46448681..3ec4baf7f280 100644 --- a/dom/base/CustomElementRegistry.h +++ b/dom/base/CustomElementRegistry.h @@ -14,7 +14,9 @@ #include "mozilla/dom/BindingDeclarations.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/FunctionBinding.h" +#include "mozilla/dom/WebComponentsBinding.h" #include "nsCycleCollectionParticipant.h" +#include "nsGenericHTMLElement.h" #include "nsWrapperCache.h" #include "nsContentUtils.h" @@ -25,7 +27,6 @@ namespace dom { struct CustomElementData; struct ElementDefinitionOptions; -struct LifecycleCallbacks; class CallbackFunction; class CustomElementReaction; class Function; @@ -117,6 +118,22 @@ struct CustomElementData // e.g., create an element, insert a node. AutoTArray, 3> mReactionQueue; + RefPtr mCustomElementDefinition; + + void + SetCustomElementDefinition(CustomElementDefinition* aDefinition) + { + MOZ_ASSERT(!mCustomElementDefinition); + + mCustomElementDefinition = aDefinition; + } + + CustomElementDefinition* + GetCustomElementDefinition() + { + return mCustomElementDefinition; + } + private: virtual ~CustomElementData() {} }; @@ -127,6 +144,9 @@ private: // https://html.spec.whatwg.org/multipage/scripting.html#custom-element-definition struct CustomElementDefinition { + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CustomElementDefinition) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CustomElementDefinition) + CustomElementDefinition(nsIAtom* aType, nsIAtom* aLocalName, Function* aConstructor, @@ -172,6 +192,9 @@ struct CustomElementDefinition return mObservedAttributes.Contains(aName); } + +private: + ~CustomElementDefinition() {} }; class CustomElementReaction @@ -394,7 +417,7 @@ private: CustomElementDefinition* aDefinition, ErrorResult& aRv); - typedef nsClassHashtable + typedef nsRefPtrHashtable DefinitionMap; typedef nsClassHashtable> CandidateMap; diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 8bde05023cfd..dd52f9053981 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -4214,6 +4214,26 @@ Element::SetCustomElementData(CustomElementData* aData) slots->mCustomElementData = aData; } +CustomElementDefinition* +Element::GetCustomElementDefinition() const +{ + CustomElementData* data = GetCustomElementData(); + if (!data) { + return nullptr; + } + + return data->GetCustomElementDefinition(); +} + +void +Element::SetCustomElementDefinition(CustomElementDefinition* aDefinition) +{ + CustomElementData* data = GetCustomElementData(); + MOZ_ASSERT(data); + + data->SetCustomElementDefinition(aDefinition); +} + MOZ_DEFINE_MALLOC_SIZE_OF(ServoElementMallocSizeOf) MOZ_DEFINE_MALLOC_ENCLOSING_SIZE_OF(ServoElementMallocEnclosingSizeOf) diff --git a/dom/base/Element.h b/dom/base/Element.h index 83735d24fc08..58e4d3e1ce0e 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -553,6 +553,22 @@ public: */ void SetCustomElementData(CustomElementData* aData); + /** + * Gets the custom element definition used by web components custom element. + * + * @return The custom element definition or null if element is not a custom + * element or custom element is not defined yet. + */ + CustomElementDefinition* GetCustomElementDefinition() const; + + /** + * Sets the custom element definition, called when custom element is created + * or upgraded. + * + * @param aDefinition The custom element definition. + */ + void SetCustomElementDefinition(CustomElementDefinition* aDefinition); + protected: /** * Method to get the _intrinsic_ content state of this element. This is the diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp index 41b8066b3ec3..cd606b5792e4 100644 --- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -812,6 +812,13 @@ FragmentOrElement::nsDOMSlots::Traverse(nsCycleCollectionTraversalCallback &cb) mExtendedSlots->mCustomElementData->mReactionQueue[i]->Traverse(cb); } } + + if (mExtendedSlots->mCustomElementData->mCustomElementDefinition) { + NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, + "mExtendedSlots->mCustomElementData->mCustomElementDefinition"); + cb.NoteNativeChild(mExtendedSlots->mCustomElementData->mCustomElementDefinition, + NS_CYCLE_COLLECTION_PARTICIPANT(CustomElementDefinition)); + } } for (auto iter = mExtendedSlots->mRegisteredIntersectionObservers.Iter(); @@ -848,7 +855,12 @@ FragmentOrElement::nsDOMSlots::Unlink() mExtendedSlots->mContainingShadow = nullptr; MOZ_ASSERT(!(mExtendedSlots->mXBLBinding)); mExtendedSlots->mXBLInsertionParent = nullptr; - mExtendedSlots->mCustomElementData = nullptr; + if (mExtendedSlots->mCustomElementData) { + if (mExtendedSlots->mCustomElementData->mCustomElementDefinition) { + mExtendedSlots->mCustomElementData->mCustomElementDefinition = nullptr; + } + mExtendedSlots->mCustomElementData = nullptr; + } mExtendedSlots->mRegisteredIntersectionObservers.Clear(); nsCOMPtr frameLoader = do_QueryInterface(mExtendedSlots->mFrameLoaderOrOpener); diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index e9a1c3922085..825c97389543 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -6313,7 +6313,8 @@ nsDocument::CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value* } nsCOMPtr typeAtom(NS_Atomize(elemName)); - CustomElementDefinition* definition = registry->mCustomDefinitions.Get(typeAtom); + CustomElementDefinition* definition = + registry->mCustomDefinitions.GetWeak(typeAtom); if (!definition) { return true; } @@ -6383,6 +6384,8 @@ nsDocument::CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value* new CustomElementData(definition->mType, CustomElementData::State::eCustom)); + element->SetCustomElementDefinition(definition); + // It'll be removed when we deprecate custom elements v0. nsContentUtils::SyncInvokeReactions(nsIDocument::eCreated, element, definition); diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index 0a90d1ff2e2b..9b8c3f58e666 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -3682,6 +3682,8 @@ CreateHTMLElement(const GlobalObject& aGlobal, const JS::CallArgs& aCallArgs, newElement->SetCustomElementData( new CustomElementData(definition->mType, CustomElementData::State::eCustom)); + newElement->SetCustomElementDefinition(definition); + return newElement.forget(); } From 2d66d1067a2d0f70c05c95225eb9a1c3c6e76b45 Mon Sep 17 00:00:00 2001 From: Jessica Jong Date: Mon, 25 Sep 2017 02:47:00 -0400 Subject: [PATCH 08/29] Bug 1392970 - Part 2: Get CustomElementDefinition from CustomElementData when possible. r=smaug MozReview-Commit-ID: L6DCtGXBesX --- dom/base/CustomElementRegistry.cpp | 66 ++++++++++++------------------ dom/base/nsContentUtils.cpp | 7 +--- 2 files changed, 27 insertions(+), 46 deletions(-) diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index 037ca52321b5..c609dfa92d1e 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -36,8 +36,20 @@ CustomElementCallback::Call() // enqueue attached callback for ELEMENT. nsIDocument* document = mThisObject->GetComposedDoc(); if (document && document->GetDocShell()) { + NodeInfo* ni = mThisObject->NodeInfo(); + nsDependentAtomString extType(mOwnerData->mType); + + // We need to do this because at this point, CustomElementDefinition is + // not set to CustomElementData yet, so EnqueueLifecycleCallback will + // fail to find the CE definition for this custom element. + // This will go away eventually since there is no created callback in v1. + CustomElementDefinition* definition = + nsContentUtils::LookupCustomElementDefinition(document, + ni->LocalName(), ni->NamespaceID(), + extType.IsEmpty() ? nullptr : &extType); + nsContentUtils::EnqueueLifecycleCallback( - document, nsIDocument::eAttached, mThisObject); + document, nsIDocument::eAttached, mThisObject, nullptr, definition); } static_cast(mCallback.get())->Call(mThisObject, rv); @@ -314,51 +326,35 @@ CustomElementRegistry::CreateCustomElementCallback( nsIDocument::ElementCallbackType aType, Element* aCustomElement, LifecycleCallbackArgs* aArgs, CustomElementDefinition* aDefinition) { + MOZ_ASSERT(aDefinition, "CustomElementDefinition should not be null"); + RefPtr elementData = aCustomElement->GetCustomElementData(); MOZ_ASSERT(elementData, "CustomElementData should exist"); - // Let DEFINITION be ELEMENT's definition - CustomElementDefinition* definition = aDefinition; - if (!definition) { - mozilla::dom::NodeInfo* info = aCustomElement->NodeInfo(); - - // Make sure we get the correct definition in case the element - // is a extended custom element e.g.