From 63dc970a467b138fdb4b110bf9bf5bf9d578a09f Mon Sep 17 00:00:00 2001 From: Robert Longson Date: Sun, 9 Feb 2014 09:46:11 +0000 Subject: [PATCH 01/19] Bug 964200 (Part 3b fix test) - Implement Filter Effects Module feDropShadow filter r=hsivonen --- dom/tests/mochitest/general/test_interfaces.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index bc89aafe7792..42f3f2283c72 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -880,6 +880,8 @@ var interfaceNamesInGlobalScope = "SVGFEDisplacementMapElement", // IMPORTANT: Do not change this list without review from a DOM peer! "SVGFEDistantLightElement", +// IMPORTANT: Do not change this list without review from a DOM peer! + "SVGFEDropShadowElement", // IMPORTANT: Do not change this list without review from a DOM peer! "SVGFEFloodElement", // IMPORTANT: Do not change this list without review from a DOM peer! From 0c051bba7554cd7c0d2e5fc6935051a2d4540b66 Mon Sep 17 00:00:00 2001 From: Robert Longson Date: Sun, 9 Feb 2014 09:46:16 +0000 Subject: [PATCH 02/19] Bug 964200 (Part 3b activate) - Implement Filter Effects Module feDropShadow filter r=mstange --- CLOBBER | 2 +- content/svg/content/src/SVGTagList.h | 1 + content/svg/content/src/moz.build | 1 + content/svg/content/test/test_SVG_namespace_ids.html | 1 + dom/system/gonk/tests/marionette/ril_jshint/jshint.js | 1 + dom/webidl/moz.build | 1 + layout/base/nsCSSFrameConstructor.cpp | 1 + 7 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CLOBBER b/CLOBBER index 33b1e1899736..5418fc7f6820 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,4 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Bug 924839 - Touching ICU's configure scripts in this bug doesn't work without a clobber. This is filed as bug 966038. +Bug 964200 - Touching webidl files in this bug doesn't work without a clobber. Tried landing already and had to back out. diff --git a/content/svg/content/src/SVGTagList.h b/content/svg/content/src/SVGTagList.h index c0014ba54d24..984f74b196d7 100644 --- a/content/svg/content/src/SVGTagList.h +++ b/content/svg/content/src/SVGTagList.h @@ -45,6 +45,7 @@ SVG_TAG(feConvolveMatrix, FEConvolveMatrix) SVG_TAG(feDiffuseLighting, FEDiffuseLighting) SVG_TAG(feDisplacementMap, FEDisplacementMap) SVG_TAG(feDistantLight, FEDistantLight) +SVG_TAG(feDropShadow, FEDropShadow) SVG_TAG(feFlood, FEFlood) SVG_TAG(feFuncA, FEFuncA) SVG_TAG(feFuncB, FEFuncB) diff --git a/content/svg/content/src/moz.build b/content/svg/content/src/moz.build index e47fbe92ee87..27109faf3aa4 100644 --- a/content/svg/content/src/moz.build +++ b/content/svg/content/src/moz.build @@ -169,6 +169,7 @@ UNIFIED_SOURCES += [ 'SVGFEDiffuseLightingElement.cpp', 'SVGFEDisplacementMapElement.cpp', 'SVGFEDistantLightElement.cpp', + 'SVGFEDropShadowElement.cpp', 'SVGFEFloodElement.cpp', 'SVGFEGaussianBlurElement.cpp', 'SVGFEImageElement.cpp', diff --git a/content/svg/content/test/test_SVG_namespace_ids.html b/content/svg/content/test/test_SVG_namespace_ids.html index 4e3c4e477645..aa9b9f5532c4 100644 --- a/content/svg/content/test/test_SVG_namespace_ids.html +++ b/content/svg/content/test/test_SVG_namespace_ids.html @@ -54,6 +54,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=589640 + diff --git a/dom/system/gonk/tests/marionette/ril_jshint/jshint.js b/dom/system/gonk/tests/marionette/ril_jshint/jshint.js index e9a8f1775201..1acdb6c80cca 100644 --- a/dom/system/gonk/tests/marionette/ril_jshint/jshint.js +++ b/dom/system/gonk/tests/marionette/ril_jshint/jshint.js @@ -462,6 +462,7 @@ exports.browser = { SVGFEDiffuseLightingElement: false, SVGFEDisplacementMapElement: false, SVGFEDistantLightElement: false, + SVGFEDropShadowElement: false, SVGFEFloodElement : false, SVGFEFuncAElement : false, SVGFEFuncBElement : false, diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index edf2f489cc3f..927e2f389dde 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -326,6 +326,7 @@ WEBIDL_FILES = [ 'SVGFEDiffuseLightingElement.webidl', 'SVGFEDisplacementMapElement.webidl', 'SVGFEDistantLightElement.webidl', + 'SVGFEDropShadowElement.webidl', 'SVGFEFloodElement.webidl', 'SVGFEFuncAElement.webidl', 'SVGFEFuncBElement.webidl', diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 678a0c99c2cf..f7cebb3553b1 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -4989,6 +4989,7 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement, SIMPLE_SVG_CREATE(feConvolveMatrix, NS_NewSVGFELeafFrame), SIMPLE_SVG_CREATE(feDiffuseLighting, NS_NewSVGFEContainerFrame), SIMPLE_SVG_CREATE(feDisplacementMap, NS_NewSVGFELeafFrame), + SIMPLE_SVG_CREATE(feDropShadow, NS_NewSVGFELeafFrame), SIMPLE_SVG_CREATE(feFlood, NS_NewSVGFELeafFrame), SIMPLE_SVG_CREATE(feGaussianBlur, NS_NewSVGFELeafFrame), SIMPLE_SVG_CREATE(feImage, NS_NewSVGFEImageFrame), From 990a62a85173cbd3712cee8cb96bf36a170d2b70 Mon Sep 17 00:00:00 2001 From: Raymond Lee Date: Sun, 9 Feb 2014 11:14:39 +0100 Subject: [PATCH 03/19] Bug 923406 - Remove localizedFilenamePrefix from PlacesBackups.js r=mak --- toolkit/components/places/PlacesBackups.jsm | 24 ++-- .../tests/unit/test_utils_backups_create.js | 125 ++++++++---------- .../en-US/chrome/places/places.properties | 7 - 3 files changed, 65 insertions(+), 91 deletions(-) diff --git a/toolkit/components/places/PlacesBackups.jsm b/toolkit/components/places/PlacesBackups.jsm index 8de3a93ea4f9..2cfa6749005c 100644 --- a/toolkit/components/places/PlacesBackups.jsm +++ b/toolkit/components/places/PlacesBackups.jsm @@ -30,15 +30,9 @@ XPCOMUtils.defineLazyGetter(this, "localFileCtor", this.PlacesBackups = { get _filenamesRegex() { - // Get the localized backup filename, will be used to clear out - // old backups with a localized name (bug 445704). - let localizedFilename = - PlacesUtils.getFormattedString("bookmarksArchiveFilename", [new Date()]); - let localizedFilenamePrefix = - localizedFilename.substr(0, localizedFilename.indexOf("-")); delete this._filenamesRegex; return this._filenamesRegex = - new RegExp("^(bookmarks|" + localizedFilenamePrefix + ")-([0-9-]+)(_[0-9]+)*\.(json|html)"); + new RegExp("^(bookmarks)-([0-9-]+)(_[0-9]+)*\.(json|html)"); }, get folder() { @@ -319,9 +313,7 @@ this.PlacesBackups = { if (aMaxBackups !== undefined && aMaxBackups > -1) { let backupFiles = yield this.getBackupFiles(); numberOfBackupsToDelete = backupFiles.length - aMaxBackups; - } - if (numberOfBackupsToDelete > 0) { // If we don't have today's backup, remove one more so that // the total backups after this operation does not exceed the // number specified in the pref. @@ -329,15 +321,15 @@ this.PlacesBackups = { !this._isFilenameWithSameDate(OS.Path.basename(mostRecentBackupFile), newBackupFilename)) numberOfBackupsToDelete++; + } - while (numberOfBackupsToDelete--) { - this._entries.pop(); - if (!this._backupFiles) { - yield this.getBackupFiles(); - } - let oldestBackup = this._backupFiles.pop(); - yield OS.File.remove(oldestBackup); + while (numberOfBackupsToDelete--) { + this._entries.pop(); + if (!this._backupFiles) { + yield this.getBackupFiles(); } + let oldestBackup = this._backupFiles.pop(); + yield OS.File.remove(oldestBackup); } // Do nothing if we already have this backup or we don't want backups. diff --git a/toolkit/components/places/tests/unit/test_utils_backups_create.js b/toolkit/components/places/tests/unit/test_utils_backups_create.js index 92c87481cd24..03cc7180fac2 100644 --- a/toolkit/components/places/tests/unit/test_utils_backups_create.js +++ b/toolkit/components/places/tests/unit/test_utils_backups_create.js @@ -9,17 +9,17 @@ */ const PREFIX = "bookmarks-"; -// The localized prefix must be "bigger" and associated to older backups. -const LOCALIZED_PREFIX = "segnalibri-"; const SUFFIX = ".json"; const NUMBER_OF_BACKUPS = 10; function run_test() { - do_test_pending(); + run_next_test(); +} +add_task(function () { // Generate random dates. - var dateObj = new Date(); - var dates = []; + let dateObj = new Date(); + let dates = []; while (dates.length < NUMBER_OF_BACKUPS) { // Use last year to ensure today's backup is the newest. let randomDate = new Date(dateObj.getFullYear() - 1, @@ -32,74 +32,63 @@ function run_test() { // Sort dates from oldest to newest. dates.sort(); - Task.spawn(function() { - // Get and cleanup the backups folder. - let backupFolderPath = yield PlacesBackups.getBackupFolder(); - let bookmarksBackupDir = new FileUtils.File(backupFolderPath); + // Get and cleanup the backups folder. + let backupFolderPath = yield PlacesBackups.getBackupFolder(); + let bookmarksBackupDir = new FileUtils.File(backupFolderPath); - // Fake backups are created backwards to ensure we won't consider file - // creation time. - // Create fake backups for the newest dates. - for (let i = dates.length - 1; i >= 0; i--) { - let backupFilename; - if (i > Math.floor(dates.length/2)) - backupFilename = PREFIX + dates[i] + SUFFIX; - else - backupFilename = LOCALIZED_PREFIX + dates[i] + SUFFIX; - let backupFile = bookmarksBackupDir.clone(); - backupFile.append(backupFilename); - backupFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0666); - do_check_true(backupFile.exists()); - } + // Fake backups are created backwards to ensure we won't consider file + // creation time. + // Create fake backups for the newest dates. + for (let i = dates.length - 1; i >= 0; i--) { + let backupFilename = PREFIX + dates[i] + SUFFIX; + let backupFile = bookmarksBackupDir.clone(); + backupFile.append(backupFilename); + backupFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("0666", 8)); + do_log_info("Creating fake backup " + backupFile.leafName); + if (!backupFile.exists()) + do_throw("Unable to create fake backup " + backupFile.leafName); + } - // Replace PlacesUtils getFormattedString so that it will return the localized - // string we want. - PlacesUtils.getFormattedString = function (aKey, aValue) { - return LOCALIZED_PREFIX + aValue; - } + yield PlacesBackups.create(NUMBER_OF_BACKUPS); + // Add today's backup. + dates.push(dateObj.toLocaleFormat("%Y-%m-%d")); - yield PlacesBackups.create(Math.floor(dates.length/2)); - // Add today's backup. - dates.push(dateObj.toLocaleFormat("%Y-%m-%d")); - - // Check backups. - for (var i = 0; i < dates.length; i++) { - let backupFilename; - let shouldExist; - let backupFile; - if (i > Math.floor(dates.length/2)) { - let files = bookmarksBackupDir.directoryEntries; - let rx = new RegExp("^" + PREFIX + dates[i] + "(_[0-9]+){0,1}" + SUFFIX + "$"); - while (files.hasMoreElements()) { - let entry = files.getNext().QueryInterface(Ci.nsIFile); - if (entry.leafName.match(rx)) { - backupFilename = entry.leafName; - backupFile = entry; - break; - } + // Check backups. We have 11 dates but we the max number is 10 so the + // oldest backup should have been removed. + for (let i = 0; i < dates.length; i++) { + let backupFilename; + let shouldExist; + let backupFile; + if (i > 0) { + let files = bookmarksBackupDir.directoryEntries; + let rx = new RegExp("^" + PREFIX + dates[i] + "(_[0-9]+){0,1}" + SUFFIX + "$"); + while (files.hasMoreElements()) { + let entry = files.getNext().QueryInterface(Ci.nsIFile); + if (entry.leafName.match(rx)) { + backupFilename = entry.leafName; + backupFile = entry; + break; } - shouldExist = true; } - else { - backupFilename = LOCALIZED_PREFIX + dates[i] + SUFFIX; - backupFile = bookmarksBackupDir.clone(); - backupFile.append(backupFilename); - shouldExist = false; - } - if (backupFile.exists() != shouldExist) - do_throw("Backup should " + (shouldExist ? "" : "not") + " exist: " + backupFilename); + shouldExist = true; } - - // Cleanup backups folder. - // XXX: Can't use bookmarksBackupDir.remove(true) because file lock happens - // on WIN XP. - let files = bookmarksBackupDir.directoryEntries; - while (files.hasMoreElements()) { - let entry = files.getNext().QueryInterface(Ci.nsIFile); - entry.remove(false); + else { + backupFilename = PREFIX + dates[i] + SUFFIX; + backupFile = bookmarksBackupDir.clone(); + backupFile.append(backupFilename); + shouldExist = false; } - do_check_false(bookmarksBackupDir.directoryEntries.hasMoreElements()); + if (backupFile.exists() != shouldExist) + do_throw("Backup should " + (shouldExist ? "" : "not") + " exist: " + backupFilename); + } - do_test_finished(); - }); -} + // Cleanup backups folder. + // XXX: Can't use bookmarksBackupDir.remove(true) because file lock happens + // on WIN XP. + let files = bookmarksBackupDir.directoryEntries; + while (files.hasMoreElements()) { + let entry = files.getNext().QueryInterface(Ci.nsIFile); + entry.remove(false); + } + do_check_false(bookmarksBackupDir.directoryEntries.hasMoreElements()); +}); diff --git a/toolkit/locales/en-US/chrome/places/places.properties b/toolkit/locales/en-US/chrome/places/places.properties index 0fa1944acf69..6b209af65eb7 100644 --- a/toolkit/locales/en-US/chrome/places/places.properties +++ b/toolkit/locales/en-US/chrome/places/places.properties @@ -24,13 +24,6 @@ finduri-MonthYear=%1$S %2$S # This is used to generate local files container when history is grouped by site localhost=(local files) -# LOCALIZATION NOTE (bookmarksArchiveFilename): -# Do not change this string! It's used only to -# detect older localized bookmark archives from -# before bug 445704 was fixed. It will be removed -# in a subsequent release. -bookmarksArchiveFilename=bookmarks-%S.json - # LOCALIZATION NOTE # The string is used for showing file size of each backup in the "fileRestorePopup" popup # %1$S is the file size From 21f9cc6065c0228760431261efe45c1546f61ce0 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Wed, 5 Feb 2014 23:08:48 +1300 Subject: [PATCH 04/19] Bug 947588. Part 1: Add "-moz-control-character-visibility" property to the style system. r=heycam Ideally we'd make this property inaccessible to Web content style sheets, but that seems hard since view-source and plain text documents seem to load in a context that's very similar to Web content as far as the style system is concerned. It doesn't matter much since it's quite safe and unlikely to be discovered or used by anyone. --HG-- extra : rebase_source : 009aafc992afd07fd76a9026afe0f6994b4b214a --- layout/style/nsCSSPropList.h | 12 ++++++++++++ layout/style/nsCSSProps.cpp | 6 ++++++ layout/style/nsCSSProps.h | 1 + layout/style/nsRuleNode.cpp | 8 ++++++++ layout/style/nsStyleConsts.h | 4 ++++ layout/style/nsStyleStruct.cpp | 5 ++++- layout/style/nsStyleStruct.h | 1 + layout/style/test/ListCSSProperties.cpp | 1 + 8 files changed, 37 insertions(+), 1 deletion(-) diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 6e42707371ad..f19241c243bd 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -1534,6 +1534,18 @@ CSS_PROP_CONTENT( kContentKTable, CSS_PROP_NO_OFFSET, eStyleAnimType_None) +#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL +CSS_PROP_TEXT( + -moz-control-character-visibility, + _moz_control_character_visibility, + CSS_PROP_DOMPROP_PREFIXED(ControlCharacterVisibility), + CSS_PROPERTY_PARSE_VALUE, + "", + VARIANT_HK, + kControlCharacterVisibilityKTable, + CSS_PROP_NO_OFFSET, + eStyleAnimType_None) +#endif CSS_PROP_CONTENT( counter-increment, counter_increment, diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 5c5048551c7b..2a6e3ad4d35c 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -914,6 +914,12 @@ const KTableValue nsCSSProps::kContentKTable[] = { eCSSKeyword_UNKNOWN,-1 }; +const KTableValue nsCSSProps::kControlCharacterVisibilityKTable[] = { + eCSSKeyword_hidden, NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN, + eCSSKeyword_visible, NS_STYLE_CONTROL_CHARACTER_VISIBILITY_VISIBLE, + eCSSKeyword_UNKNOWN,-1 +}; + const KTableValue nsCSSProps::kCursorKTable[] = { // CSS 2.0 eCSSKeyword_auto, NS_STYLE_CURSOR_AUTO, diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index 4d1d749b0bda..038efe768b2d 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -491,6 +491,7 @@ public: static const KTableValue kClearKTable[]; static const KTableValue kColorKTable[]; static const KTableValue kContentKTable[]; + static const KTableValue kControlCharacterVisibilityKTable[]; static const KTableValue kCursorKTable[]; static const KTableValue kDirectionKTable[]; static const KTableValue kDisplayKTable[]; diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 079daa271546..42af06ced594 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -4219,6 +4219,14 @@ nsRuleNode::ComputeTextData(void* aStartStruct, NS_STYLE_TEXT_SIZE_ADJUST_NONE, // none value 0, 0); + // -moz-text-discard: enum, inherit, initial + SetDiscrete(*aRuleData->ValueForControlCharacterVisibility(), + text->mControlCharacterVisibility, + canStoreInRuleTree, + SETDSC_ENUMERATED | SETDSC_UNSET_INHERIT, + parentText->mControlCharacterVisibility, + NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN, 0, 0, 0, 0); + // text-orientation: enum, inherit, initial SetDiscrete(*aRuleData->ValueForTextOrientation(), text->mTextOrientation, canStoreInRuleTree, diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index 9b6cf6cac345..94da4dd04e2a 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -1025,6 +1025,10 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { #define NS_STYLE_BLEND_COLOR 14 #define NS_STYLE_BLEND_LUMINOSITY 15 +// See nsStyleText::mControlCharacterVisibility +#define NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN 0 +#define NS_STYLE_CONTROL_CHARACTER_VISIBILITY_VISIBLE 1 + /***************************************************************************** * Constants for media features. * *****************************************************************************/ diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index fff90571d615..6eafb5103eae 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -2970,6 +2970,7 @@ nsStyleText::nsStyleText(void) mTextSizeAdjust = NS_STYLE_TEXT_SIZE_ADJUST_AUTO; mTextOrientation = NS_STYLE_TEXT_ORIENTATION_AUTO; mTextCombineHorizontal = NS_STYLE_TEXT_COMBINE_HORIZ_NONE; + mControlCharacterVisibility = NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN; mLetterSpacing.SetNormalValue(); mLineHeight.SetNormalValue(); @@ -2993,6 +2994,7 @@ nsStyleText::nsStyleText(const nsStyleText& aSource) mTextSizeAdjust(aSource.mTextSizeAdjust), mTextOrientation(aSource.mTextOrientation), mTextCombineHorizontal(aSource.mTextCombineHorizontal), + mControlCharacterVisibility(aSource.mControlCharacterVisibility), mTabSize(aSource.mTabSize), mWordSpacing(aSource.mWordSpacing), mLetterSpacing(aSource.mLetterSpacing), @@ -3016,7 +3018,8 @@ nsChangeHint nsStyleText::CalcDifference(const nsStyleText& aOther) const return NS_STYLE_HINT_FRAMECHANGE; } - if (mTextCombineHorizontal != aOther.mTextCombineHorizontal) { + if (mTextCombineHorizontal != aOther.mTextCombineHorizontal || + mControlCharacterVisibility != aOther.mControlCharacterVisibility) { return nsChangeHint_ReconstructFrame; } diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 3fdb92d452a6..f72a66365579 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -1395,6 +1395,7 @@ struct nsStyleText { uint8_t mTextSizeAdjust; // [inherited] see nsStyleConsts.h uint8_t mTextOrientation; // [inherited] see nsStyleConsts.h uint8_t mTextCombineHorizontal; // [inherited] see nsStyleConsts.h + uint8_t mControlCharacterVisibility; // [inherited] see nsStyleConsts.h int32_t mTabSize; // [inherited] see nsStyleConsts.h nscoord mWordSpacing; // [inherited] diff --git a/layout/style/test/ListCSSProperties.cpp b/layout/style/test/ListCSSProperties.cpp index 531ecf4b6cfe..e213e25377df 100644 --- a/layout/style/test/ListCSSProperties.cpp +++ b/layout/style/test/ListCSSProperties.cpp @@ -144,6 +144,7 @@ const char *gInaccessibleProperties[] = { "padding-left-rtl-source", "padding-right-ltr-source", "padding-right-rtl-source", + "-moz-control-character-visibility", "-moz-script-level", // parsed by UA sheets only "-moz-script-size-multiplier", "-moz-script-min-size", From 43edbab0e38a9c7d7e4ef2f9772a648e8a3898d6 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Wed, 5 Feb 2014 23:08:58 +1300 Subject: [PATCH 05/19] Bug 947588. Part 2: Add gfxTextRunFactory::TEXT_HIDE_CONTROL_CHARACTERS to guard usage of IsInvalidControlChar. r=jfkthame --HG-- extra : rebase_source : 2ce426ebf3ad1643038954bcb18553dec27153c9 --- gfx/thebes/gfxFont.cpp | 6 ++++-- gfx/thebes/gfxFont.h | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index c1f0523cc53e..7b18fbd35acb 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -3482,7 +3482,8 @@ gfxFont::ShapeTextWithoutWordCache(gfxContext *aContext, aTextRun->SetIsTab(aOffset + i); } else if (ch == '\n') { aTextRun->SetIsNewline(aOffset + i); - } else if (IsInvalidControlChar(ch)) { + } else if (IsInvalidControlChar(ch) && + !(aTextRun->GetFlags() & gfxTextRunFactory::TEXT_HIDE_CONTROL_CHARACTERS)) { aTextRun->SetMissingGlyph(aOffset + i, ch, this); } fragStart = i + 1; @@ -3652,7 +3653,8 @@ gfxFont::SplitAndInitTextRun(gfxContext *aContext, aTextRun->SetIsTab(aRunStart + i); } else if (ch == '\n') { aTextRun->SetIsNewline(aRunStart + i); - } else if (IsInvalidControlChar(ch)) { + } else if (IsInvalidControlChar(ch) && + !(aTextRun->GetFlags() & gfxTextRunFactory::TEXT_HIDE_CONTROL_CHARACTERS)) { aTextRun->SetMissingGlyph(aRunStart + i, ch, this); } diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index 0686609697aa..9ad52744e1ac 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -1137,6 +1137,11 @@ public: * textruns that have been seen so as to avoid multiple-accounting. */ TEXT_RUN_SIZE_ACCOUNTED = 0x0200, + /** + * When set, the textrun should discard control characters instead of + * turning them into hexboxes. + */ + TEXT_HIDE_CONTROL_CHARACTERS = 0x0400, /** * nsTextFrameThebes sets these, but they're defined here rather than From e7b62f678423a6b50059384b493e767fac67cdb3 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Wed, 5 Feb 2014 23:16:23 +1300 Subject: [PATCH 06/19] Bug 947588. Part 3: Map nsStyleText::mControlCharacterVisibility to TEXT_HIDE_CONTROL_CHARACTERS flag in nsTextFrame. r=jfkthame Note that this is set up so any use of gfxTextRun outside of nsTextFrame shows hexboxes for control characters. --HG-- extra : rebase_source : 83335c85c4db4a6391f18924aad566b00fd6a66c --- layout/base/nsLayoutUtils.cpp | 4 ++++ layout/base/nsLayoutUtils.h | 1 + layout/generic/nsTextFrame.cpp | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 095353700e3c..456ea1beb619 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -4700,12 +4700,16 @@ nsLayoutUtils::GetDisplayRootFrame(nsIFrame* aFrame) /* static */ uint32_t nsLayoutUtils::GetTextRunFlagsForStyle(nsStyleContext* aStyleContext, const nsStyleFont* aStyleFont, + const nsStyleText* aStyleText, nscoord aLetterSpacing) { uint32_t result = 0; if (aLetterSpacing != 0) { result |= gfxTextRunFactory::TEXT_DISABLE_OPTIONAL_LIGATURES; } + if (aStyleText->mControlCharacterVisibility == NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN) { + result |= gfxTextRunFactory::TEXT_HIDE_CONTROL_CHARACTERS; + } switch (aStyleContext->StyleSVG()->mTextRendering) { case NS_STYLE_TEXT_RENDERING_OPTIMIZESPEED: result |= gfxTextRunFactory::TEXT_OPTIMIZE_SPEED; diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 45f60a814ca1..7ae017c10fcf 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -1525,6 +1525,7 @@ public: */ static uint32_t GetTextRunFlagsForStyle(nsStyleContext* aStyleContext, const nsStyleFont* aStyleFont, + const nsStyleText* aStyleText, nscoord aLetterSpacing); /** diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 03e84ac98df1..6681a2c70142 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -1650,8 +1650,8 @@ BuildTextRunsScanner::ContinueTextRunAcrossFrames(nsTextFrame* aFrame1, nsTextFr return fontStyle1->mFont.BaseEquals(fontStyle2->mFont) && sc1->StyleFont()->mLanguage == sc2->StyleFont()->mLanguage && textStyle1->mTextTransform == textStyle2->mTextTransform && - nsLayoutUtils::GetTextRunFlagsForStyle(sc1, fontStyle1, letterSpacing1) == - nsLayoutUtils::GetTextRunFlagsForStyle(sc2, fontStyle2, letterSpacing2); + nsLayoutUtils::GetTextRunFlagsForStyle(sc1, fontStyle1, textStyle1, letterSpacing1) == + nsLayoutUtils::GetTextRunFlagsForStyle(sc2, fontStyle2, textStyle2, letterSpacing2); } void BuildTextRunsScanner::ScanFrame(nsIFrame* aFrame) @@ -2066,7 +2066,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer) // frame's style is used, so we use a mixture of the first frame and // last frame's style textFlags |= nsLayoutUtils::GetTextRunFlagsForStyle(lastStyleContext, - fontStyle, LetterSpacing(firstFrame, textStyle)); + fontStyle, textStyle, LetterSpacing(firstFrame, textStyle)); // XXX this is a bit of a hack. For performance reasons, if we're favouring // performance over quality, don't try to get accurate glyph extents. if (!(textFlags & gfxTextRunFactory::TEXT_OPTIMIZE_SPEED)) { From 1e8f5d4c97e5285dfe760c126b59823ea4eac60d Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Wed, 5 Feb 2014 23:22:21 +1300 Subject: [PATCH 07/19] Bug 947588. Part 3.9: Remove CRs from plaintext.css. r=heycam --HG-- extra : rebase_source : 0cf0bb02d4edcc848f71ec498fd2521312521ae8 --- layout/style/plaintext.css | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/layout/style/plaintext.css b/layout/style/plaintext.css index ca8839ad84bc..93a57153cbaa 100644 --- a/layout/style/plaintext.css +++ b/layout/style/plaintext.css @@ -1,8 +1,8 @@ -/* 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/. */ - -pre { - white-space: pre-wrap; - word-wrap: break-word; -} +/* 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/. */ + +pre { + white-space: pre-wrap; + word-wrap: break-word; +} From 533e04ff7519dd7c4ab1c7110a861684a2caa3af Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Wed, 5 Feb 2014 23:23:08 +1300 Subject: [PATCH 08/19] Bug 947588. Part 4: Set -moz-text-discard:none in devtools, XUL, text inputs, plaintext documents, view-source documents. r=heycam --HG-- extra : rebase_source : 2db920396d9c5f8de51c4385250f2903629441fc --- browser/devtools/markupview/markup-view.css | 4 ++++ layout/style/forms.css | 1 + layout/style/plaintext.css | 1 + layout/style/viewsource.css | 1 + toolkit/content/xul.css | 1 + 5 files changed, 8 insertions(+) diff --git a/browser/devtools/markupview/markup-view.css b/browser/devtools/markupview/markup-view.css index 49c9ecbb75ae..62d1fa36b999 100644 --- a/browser/devtools/markupview/markup-view.css +++ b/browser/devtools/markupview/markup-view.css @@ -2,6 +2,10 @@ * 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/. */ +:root { + -moz-control-character-visibility: visible; +} + /* Force height and width (possibly overflowing) from inline elements. * This allows long overflows of text or input fields to still be styled with * the container, rather than the background disappearing when scrolling */ diff --git a/layout/style/forms.css b/layout/style/forms.css index d7e019aa1be4..83d4b7f9968c 100644 --- a/layout/style/forms.css +++ b/layout/style/forms.css @@ -136,6 +136,7 @@ textarea::-moz-placeholder { display: inline-block; ime-mode: inherit; resize: inherit; + -moz-control-character-visibility: visible; } textarea > .anonymous-div.wrap, diff --git a/layout/style/plaintext.css b/layout/style/plaintext.css index 93a57153cbaa..2cc41c838839 100644 --- a/layout/style/plaintext.css +++ b/layout/style/plaintext.css @@ -5,4 +5,5 @@ pre { white-space: pre-wrap; word-wrap: break-word; + -moz-control-character-visibility: visible; } diff --git a/layout/style/viewsource.css b/layout/style/viewsource.css index ff205aa1da97..85526fe110fd 100644 --- a/layout/style/viewsource.css +++ b/layout/style/viewsource.css @@ -9,6 +9,7 @@ background-color: white; color: black; direction: ltr; + -moz-control-character-visibility: visible; } #viewsource { font-family: -moz-fixed; diff --git a/toolkit/content/xul.css b/toolkit/content/xul.css index a47da1fc906a..9ed03f7f697d 100644 --- a/toolkit/content/xul.css +++ b/toolkit/content/xul.css @@ -24,6 +24,7 @@ :root { text-rendering: optimizeLegibility; -moz-binding: url("chrome://global/content/bindings/general.xml#root-element"); + -moz-control-character-visibility: visible; } :root:-moz-locale-dir(rtl) { From 589c48df61487cac05045318371a06c840c340e5 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Wed, 5 Feb 2014 23:23:50 +1300 Subject: [PATCH 09/19] Bug 947588. Part 5: Fix tests to pass even if regular HTML content is not displaying hexboxes for control characters. r=jfkthame --HG-- extra : rebase_source : 8eea41432c267b4ace85d1230c5dba76fe7cc3c4 --- layout/reftests/text/control-chars-01-notref.html | 2 ++ layout/reftests/text/control-chars-01a.html | 2 ++ layout/reftests/text/control-chars-01b.html | 2 ++ layout/reftests/text/control-chars-01c.html | 2 ++ layout/reftests/text/control-chars-01d.html | 2 ++ layout/reftests/text/control-chars-02-notref.html | 6 ++++++ layout/reftests/text/control-chars-02.html | 6 ++++++ layout/reftests/text/control-chars-03-ref.html | 6 ++++++ layout/reftests/text/control-chars-03a.html | 6 ++++++ layout/reftests/text/control-chars-03b.html | 10 ++++++++++ layout/reftests/text/reftest.list | 3 +++ 11 files changed, 47 insertions(+) create mode 100644 layout/reftests/text/control-chars-02-notref.html create mode 100644 layout/reftests/text/control-chars-02.html create mode 100644 layout/reftests/text/control-chars-03-ref.html create mode 100644 layout/reftests/text/control-chars-03a.html create mode 100644 layout/reftests/text/control-chars-03b.html diff --git a/layout/reftests/text/control-chars-01-notref.html b/layout/reftests/text/control-chars-01-notref.html index 092f656e9e62..3b7735d33b30 100644 --- a/layout/reftests/text/control-chars-01-notref.html +++ b/layout/reftests/text/control-chars-01-notref.html @@ -4,6 +4,8 @@ + diff --git a/layout/reftests/text/control-chars-01a.html b/layout/reftests/text/control-chars-01a.html index 93d06a2a2cbb..1dbd34ba666a 100644 --- a/layout/reftests/text/control-chars-01a.html +++ b/layout/reftests/text/control-chars-01a.html @@ -4,6 +4,8 @@ + diff --git a/layout/reftests/text/control-chars-01b.html b/layout/reftests/text/control-chars-01b.html index 235be11c8279..19e08552da7e 100644 --- a/layout/reftests/text/control-chars-01b.html +++ b/layout/reftests/text/control-chars-01b.html @@ -4,6 +4,8 @@ + diff --git a/layout/reftests/text/control-chars-01c.html b/layout/reftests/text/control-chars-01c.html index b48e9dc45550..28504d4f4303 100644 --- a/layout/reftests/text/control-chars-01c.html +++ b/layout/reftests/text/control-chars-01c.html @@ -4,6 +4,8 @@ + diff --git a/layout/reftests/text/control-chars-01d.html b/layout/reftests/text/control-chars-01d.html index b1847d09d77a..561489b25987 100644 --- a/layout/reftests/text/control-chars-01d.html +++ b/layout/reftests/text/control-chars-01d.html @@ -4,6 +4,8 @@ + diff --git a/layout/reftests/text/control-chars-02-notref.html b/layout/reftests/text/control-chars-02-notref.html new file mode 100644 index 000000000000..fe88d751b639 --- /dev/null +++ b/layout/reftests/text/control-chars-02-notref.html @@ -0,0 +1,6 @@ + + + +foobar + + diff --git a/layout/reftests/text/control-chars-02.html b/layout/reftests/text/control-chars-02.html new file mode 100644 index 000000000000..63210d20e8c8 --- /dev/null +++ b/layout/reftests/text/control-chars-02.html @@ -0,0 +1,6 @@ + + + +foobar + + diff --git a/layout/reftests/text/control-chars-03-ref.html b/layout/reftests/text/control-chars-03-ref.html new file mode 100644 index 000000000000..2fecd054f9f6 --- /dev/null +++ b/layout/reftests/text/control-chars-03-ref.html @@ -0,0 +1,6 @@ + + + +foobar + + diff --git a/layout/reftests/text/control-chars-03a.html b/layout/reftests/text/control-chars-03a.html new file mode 100644 index 000000000000..27fa168f1831 --- /dev/null +++ b/layout/reftests/text/control-chars-03a.html @@ -0,0 +1,6 @@ + + + +foobar + + diff --git a/layout/reftests/text/control-chars-03b.html b/layout/reftests/text/control-chars-03b.html new file mode 100644 index 000000000000..488e5e7513f0 --- /dev/null +++ b/layout/reftests/text/control-chars-03b.html @@ -0,0 +1,10 @@ + + + +foobar + + + diff --git a/layout/reftests/text/reftest.list b/layout/reftests/text/reftest.list index 61c641a197bc..e4630d9baf17 100644 --- a/layout/reftests/text/reftest.list +++ b/layout/reftests/text/reftest.list @@ -292,3 +292,6 @@ pref(layout.css.text-align-true-value.enabled,true) == text-align-true.html text != control-chars-01b.html control-chars-01-notref.html != control-chars-01c.html control-chars-01-notref.html != control-chars-01d.html control-chars-01-notref.html +!= control-chars-02.html control-chars-02-notref.html +== control-chars-03a.html control-chars-03-ref.html +== control-chars-03b.html control-chars-03-ref.html From 06ce6ca076642b0a6dcbe3dd166ffa3f5e8cbbaa Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sun, 9 Feb 2014 09:00:49 -0500 Subject: [PATCH 10/19] Bug 969908 - Stop checking the return value of nsTArray::SetLength in MobileConnectionArray; r=khuey --- dom/mobileconnection/src/MobileConnectionArray.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dom/mobileconnection/src/MobileConnectionArray.cpp b/dom/mobileconnection/src/MobileConnectionArray.cpp index 38f898fa980c..e3986d466598 100644 --- a/dom/mobileconnection/src/MobileConnectionArray.cpp +++ b/dom/mobileconnection/src/MobileConnectionArray.cpp @@ -38,8 +38,7 @@ MobileConnectionArray::MobileConnectionArray(nsPIDOMWindow* aWindow) uint32_t numRil = mozilla::Preferences::GetUint("ril.numRadioInterfaces", 1); MOZ_ASSERT(numRil > 0); - bool ret = mMobileConnections.SetLength(numRil); - MOZ_ASSERT(ret); + mMobileConnections.SetLength(numRil); SetIsDOMBinding(); } From 22cd0287dc70564e24b6e32f4a1a23381343aff2 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sun, 9 Feb 2014 11:34:22 -0500 Subject: [PATCH 11/19] Bug 970041 - Use fallible allocation in Windows font code; r=jfkthame --- gfx/thebes/gfxDWriteFontList.cpp | 8 ++++---- gfx/thebes/gfxDWriteShaper.cpp | 12 ++++++------ gfx/thebes/gfxGDIFontList.cpp | 4 ++-- gfx/thebes/gfxGDIShaper.cpp | 4 ++-- gfx/thebes/gfxUniscribeShaper.cpp | 12 ++++++------ 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/gfx/thebes/gfxDWriteFontList.cpp b/gfx/thebes/gfxDWriteFontList.cpp index 8f5729473140..70a05fce67ae 100644 --- a/gfx/thebes/gfxDWriteFontList.cpp +++ b/gfx/thebes/gfxDWriteFontList.cpp @@ -310,7 +310,7 @@ gfxDWriteFontFamily::LocalizedName(nsAString &aLocalizedName) idx = 0; } } - nsAutoTArray famName; + AutoFallibleTArray famName; UINT32 length; hr = names->GetStringLength(idx, &length); @@ -991,7 +991,7 @@ gfxDWriteFontList::DelayedInitFontList() englishIdx = 0; } - nsAutoTArray enName; + AutoFallibleTArray enName; UINT32 length; hr = names->GetStringLength(englishIdx, &length); @@ -1036,7 +1036,7 @@ gfxDWriteFontList::DelayedInitFontList() for (nameIndex = 0; nameIndex < nameCount; nameIndex++) { UINT32 nameLen; - nsAutoTArray localizedName; + AutoFallibleTArray localizedName; // only add other names if (nameIndex == englishIdx) { @@ -1402,7 +1402,7 @@ static HRESULT GetFamilyName(IDWriteFont *aFont, nsString& aFamilyName) index = 0; } - nsAutoTArray name; + AutoFallibleTArray name; UINT32 length; hr = familyNames->GetStringLength(index, &length); diff --git a/gfx/thebes/gfxDWriteShaper.cpp b/gfx/thebes/gfxDWriteShaper.cpp index 360a086a4aa9..4526d28f315b 100644 --- a/gfx/thebes/gfxDWriteShaper.cpp +++ b/gfx/thebes/gfxDWriteShaper.cpp @@ -67,10 +67,10 @@ trymoreglyphs: } maxGlyphs += 3 * length / 2 + 16; - nsAutoTArray clusters; - nsAutoTArray indices; - nsAutoTArray textProperties; - nsAutoTArray glyphProperties; + AutoFallibleTArray clusters; + AutoFallibleTArray indices; + AutoFallibleTArray textProperties; + AutoFallibleTArray glyphProperties; if (!clusters.SetLength(length) || !indices.SetLength(maxGlyphs) || !textProperties.SetLength(maxGlyphs) || @@ -98,8 +98,8 @@ trymoreglyphs: } WORD gID = indices[0]; - nsAutoTArray advances; - nsAutoTArray glyphOffsets; + AutoFallibleTArray advances; + AutoFallibleTArray glyphOffsets; if (!advances.SetLength(actualGlyphs) || !glyphOffsets.SetLength(actualGlyphs)) { NS_WARNING("Shaper failed to allocate memory."); diff --git a/gfx/thebes/gfxGDIFontList.cpp b/gfx/thebes/gfxGDIFontList.cpp index e1837dccaf9b..2177bba40018 100644 --- a/gfx/thebes/gfxGDIFontList.cpp +++ b/gfx/thebes/gfxGDIFontList.cpp @@ -989,7 +989,7 @@ int CALLBACK GDIFontInfo::EnumerateFontsForFamily( uint32_t kNAME = NativeEndian::swapToBigEndian(TRUETYPE_TAG('n','a','m','e')); uint32_t nameSize; - nsAutoTArray nameData; + AutoFallibleTArray nameData; nameSize = ::GetFontData(hdc, kNAME, 0, nullptr, 0); if (nameSize != GDI_ERROR && @@ -1032,7 +1032,7 @@ int CALLBACK GDIFontInfo::EnumerateFontsForFamily( uint32_t kCMAP = NativeEndian::swapToBigEndian(TRUETYPE_TAG('c','m','a','p')); uint32_t cmapSize; - nsAutoTArray cmapData; + AutoFallibleTArray cmapData; cmapSize = ::GetFontData(hdc, kCMAP, 0, nullptr, 0); if (cmapSize != GDI_ERROR && diff --git a/gfx/thebes/gfxGDIShaper.cpp b/gfx/thebes/gfxGDIShaper.cpp index 2ff5925d6222..f38cd8f66b6f 100644 --- a/gfx/thebes/gfxGDIShaper.cpp +++ b/gfx/thebes/gfxGDIShaper.cpp @@ -25,7 +25,7 @@ gfxGDIShaper::ShapeText(gfxContext *aContext, AutoSelectFont selectFont(dc, static_cast(mFont)->GetHFONT()); uint32_t length = aLength; - nsAutoTArray glyphArray; + AutoFallibleTArray glyphArray; if (!glyphArray.SetLength(length)) { return false; } @@ -43,7 +43,7 @@ gfxGDIShaper::ShapeText(gfxContext *aContext, } SIZE size; - nsAutoTArray partialWidthArray; + AutoFallibleTArray partialWidthArray; if (!partialWidthArray.SetLength(length)) { return false; } diff --git a/gfx/thebes/gfxUniscribeShaper.cpp b/gfx/thebes/gfxUniscribeShaper.cpp index 2a5fbecfda98..2e16be22665a 100644 --- a/gfx/thebes/gfxUniscribeShaper.cpp +++ b/gfx/thebes/gfxUniscribeShaper.cpp @@ -349,12 +349,12 @@ private: #define AVERAGE_ITEM_LENGTH 40 - nsAutoTArray mGlyphs; - nsAutoTArray mClusters; - nsAutoTArray mAttr; + AutoFallibleTArray mGlyphs; + AutoFallibleTArray mClusters; + AutoFallibleTArray mAttr; - nsAutoTArray mOffsets; - nsAutoTArray mAdvances; + AutoFallibleTArray mOffsets; + AutoFallibleTArray mAdvances; #undef AVERAGE_ITEM_LENGTH @@ -424,7 +424,7 @@ private: SCRIPT_CONTROL mControl; SCRIPT_STATE mState; - nsTArray mItems; + FallibleTArray mItems; int mNumItems; }; From 02e4ce0af0c6bd531576151a602deb70f85425ed Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Sun, 9 Feb 2014 11:00:03 -0800 Subject: [PATCH 12/19] Bug 969764: Properly carry the source's element attribute name through off-thread compilations. r=bhackett --- .../jit-test/tests/debug/Source-element-03.js | 24 +++++++++++++++++++ js/src/jsapi.cpp | 1 + 2 files changed, 25 insertions(+) create mode 100644 js/src/jit-test/tests/debug/Source-element-03.js diff --git a/js/src/jit-test/tests/debug/Source-element-03.js b/js/src/jit-test/tests/debug/Source-element-03.js new file mode 100644 index 000000000000..fefa9866865b --- /dev/null +++ b/js/src/jit-test/tests/debug/Source-element-03.js @@ -0,0 +1,24 @@ +// Owning elements and attribute names are attached to scripts compiled +// off-thread. + +var g = newGlobal(); +var dbg = new Debugger; +var gDO = dbg.addDebuggee(g); + +var elt = new g.Object; +var eltDO = gDO.makeDebuggeeValue(elt); + +var log = ''; +dbg.onDebuggerStatement = function (frame) { + log += 'd'; + var source = frame.script.source; + assertEq(source.element, eltDO); + assertEq(source.elementAttributeName, 'mass'); +}; + +g.offThreadCompileScript('debugger;', + { element: elt, + elementAttributeName: 'mass' }); +log += 'o'; +g.runOffThreadScript(); +assertEq(log, 'od'); diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 3fe58d9f38ea..5adbd4efc31c 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -4355,6 +4355,7 @@ JS::OwningCompileOptions::copy(JSContext *cx, const ReadOnlyCompileOptions &rhs) setPrincipals(rhs.principals()); setOriginPrincipals(rhs.originPrincipals()); setElement(rhs.element()); + setElementAttributeName(rhs.elementAttributeName()); return (setFileAndLine(cx, rhs.filename(), rhs.lineno) && setSourceMapURL(cx, rhs.sourceMapURL()) && From d1df66e05b0e6318cef1df5e5fd42449101d67a7 Mon Sep 17 00:00:00 2001 From: "Nicholas D. Matsakis" Date: Fri, 7 Feb 2014 13:48:35 -0500 Subject: [PATCH 13/19] Bug 969159 -- Adjust assertion to account for zero-sized objects r=shu --- js/src/builtin/TypedObject.cpp | 1 + js/src/builtin/TypedObject.h | 7 ++++++- js/src/jit-test/tests/TypedObject/bug969159.js | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 js/src/jit-test/tests/TypedObject/bug969159.js diff --git a/js/src/builtin/TypedObject.cpp b/js/src/builtin/TypedObject.cpp index b22a1dd67df3..74acc02fd9cc 100644 --- a/js/src/builtin/TypedObject.cpp +++ b/js/src/builtin/TypedObject.cpp @@ -1341,6 +1341,7 @@ void TypedDatum::attach(TypedDatum &datum, uint32_t offset) { JS_ASSERT(datum.getReservedSlot(JS_DATUM_SLOT_OWNER).isObject()); + JS_ASSERT(offset + size() <= datum.size()); // find the location in memory uint8_t *mem = datum.typedMem(offset); diff --git a/js/src/builtin/TypedObject.h b/js/src/builtin/TypedObject.h index 9c0022b325d4..de71a9bc18fb 100644 --- a/js/src/builtin/TypedObject.h +++ b/js/src/builtin/TypedObject.h @@ -516,7 +516,12 @@ class TypedDatum : public JSObject } uint8_t *typedMem(size_t offset) const { - JS_ASSERT(offset < size()); + // It seems a bit surprising that one might request an offset + // == size(), but it can happen when taking the "address of" a + // 0-sized value. (In other words, we maintain the invariant + // that `offset + size <= size()` -- this is always checked in + // the caller's side.) + JS_ASSERT(offset <= size()); return typedMem() + offset; } }; diff --git a/js/src/jit-test/tests/TypedObject/bug969159.js b/js/src/jit-test/tests/TypedObject/bug969159.js new file mode 100644 index 000000000000..18534a60992a --- /dev/null +++ b/js/src/jit-test/tests/TypedObject/bug969159.js @@ -0,0 +1,9 @@ +// Test access to a 0-sized element (in this case, +// a zero-length array). + +if (!this.hasOwnProperty("TypedObject")) + quit(); + +var AA = TypedObject.uint8.array(0.).array(5); +var aa = new AA(); +var aa0 = aa[0]; From b7774ff5f7ebc160a08eaae2e7b61c8b801e0e82 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Mon, 10 Feb 2014 07:47:25 +1100 Subject: [PATCH 14/19] Bug 969941 - Add lldb type summaries for nsFixed(C)String and nsAuto(C)String. r=ehsan (NPOTB, DONTBUILD) --- python/lldbutils/lldbutils/general.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/lldbutils/lldbutils/general.py b/python/lldbutils/lldbutils/general.py index dd1be5f592b9..8bf3796abbd0 100644 --- a/python/lldbutils/lldbutils/general.py +++ b/python/lldbutils/lldbutils/general.py @@ -69,6 +69,10 @@ def prefcnt(debugger, command, result, dict): def init(debugger): debugger.HandleCommand("type summary add nsAString_internal -F lldbutils.general.summarize_string") debugger.HandleCommand("type summary add nsACString_internal -F lldbutils.general.summarize_string") + debugger.HandleCommand("type summary add nsFixedString -F lldbutils.general.summarize_string") + debugger.HandleCommand("type summary add nsFixedCString -F lldbutils.general.summarize_string") + debugger.HandleCommand("type summary add nsAutoString -F lldbutils.general.summarize_string") + debugger.HandleCommand("type summary add nsAutoCString -F lldbutils.general.summarize_string") debugger.HandleCommand("type synthetic add -x \"nsTArray<\" -l lldbutils.general.TArraySyntheticChildrenProvider") debugger.HandleCommand("type synthetic add -x \"nsAutoTArray<\" -l lldbutils.general.TArraySyntheticChildrenProvider") debugger.HandleCommand("type synthetic add -x \"FallibleTArray<\" -l lldbutils.general.TArraySyntheticChildrenProvider") From 52af170da883d392d2310a49b494211be43c03dd Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Mon, 10 Feb 2014 08:50:48 +1100 Subject: [PATCH 15/19] Bug 969941 - Small documentation followup. (NPOTB, DONTBUILD) --- python/lldbutils/README.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/lldbutils/README.txt b/python/lldbutils/README.txt index c214282f695c..ec8c089411d4 100644 --- a/python/lldbutils/README.txt +++ b/python/lldbutils/README.txt @@ -125,7 +125,9 @@ For objects that do have synthetic children defined for them, like nsTArray, the "expr -R -- EXPR" command can be used to show its actual member variables. -* nsAString, nsACString +* nsAString, nsACString, + nsFixedString, nsFixedCString, + nsAutoString, nsAutoCString Strings have a type summary that shows the actual string. From b3e7169e0e7e10e96ee3e2b63d4cd042e17255f7 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sun, 9 Feb 2014 14:11:40 -0800 Subject: [PATCH 16/19] Back out 8a36e37f46ed (bug 969159) for Valgrind bustage --- js/src/builtin/TypedObject.cpp | 1 - js/src/builtin/TypedObject.h | 7 +------ js/src/jit-test/tests/TypedObject/bug969159.js | 9 --------- 3 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 js/src/jit-test/tests/TypedObject/bug969159.js diff --git a/js/src/builtin/TypedObject.cpp b/js/src/builtin/TypedObject.cpp index 74acc02fd9cc..b22a1dd67df3 100644 --- a/js/src/builtin/TypedObject.cpp +++ b/js/src/builtin/TypedObject.cpp @@ -1341,7 +1341,6 @@ void TypedDatum::attach(TypedDatum &datum, uint32_t offset) { JS_ASSERT(datum.getReservedSlot(JS_DATUM_SLOT_OWNER).isObject()); - JS_ASSERT(offset + size() <= datum.size()); // find the location in memory uint8_t *mem = datum.typedMem(offset); diff --git a/js/src/builtin/TypedObject.h b/js/src/builtin/TypedObject.h index de71a9bc18fb..9c0022b325d4 100644 --- a/js/src/builtin/TypedObject.h +++ b/js/src/builtin/TypedObject.h @@ -516,12 +516,7 @@ class TypedDatum : public JSObject } uint8_t *typedMem(size_t offset) const { - // It seems a bit surprising that one might request an offset - // == size(), but it can happen when taking the "address of" a - // 0-sized value. (In other words, we maintain the invariant - // that `offset + size <= size()` -- this is always checked in - // the caller's side.) - JS_ASSERT(offset <= size()); + JS_ASSERT(offset < size()); return typedMem() + offset; } }; diff --git a/js/src/jit-test/tests/TypedObject/bug969159.js b/js/src/jit-test/tests/TypedObject/bug969159.js deleted file mode 100644 index 18534a60992a..000000000000 --- a/js/src/jit-test/tests/TypedObject/bug969159.js +++ /dev/null @@ -1,9 +0,0 @@ -// Test access to a 0-sized element (in this case, -// a zero-length array). - -if (!this.hasOwnProperty("TypedObject")) - quit(); - -var AA = TypedObject.uint8.array(0.).array(5); -var aa = new AA(); -var aa0 = aa[0]; From c93bdc080beb5f45ed491c9988bbcafcb0f4bd93 Mon Sep 17 00:00:00 2001 From: Mark Hammond Date: Mon, 10 Feb 2014 09:23:02 +1100 Subject: [PATCH 17/19] Bug 968044 - prevent xpcshell test output from escaping CR chars. r=gps --- testing/xpcshell/runxpcshelltests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py index 3bb678b0d4c8..565acb31eec9 100644 --- a/testing/xpcshell/runxpcshelltests.py +++ b/testing/xpcshell/runxpcshelltests.py @@ -77,9 +77,9 @@ import mozinfo # TODO: perhaps this should be in a more generally shared location? # This regex matches all of the C0 and C1 control characters # (U+0000 through U+001F; U+007F; U+0080 through U+009F), -# except TAB (U+0009) and LF (U+000A); also, backslash (U+005C). +# except TAB (U+0009), CR (U+000D), LF (U+000A) and backslash (U+005C). # A raw string is deliberately not used. -_cleanup_encoding_re = re.compile(u'[\x00-\x08\x0b-\x1f\x7f-\x9f\\\\]') +_cleanup_encoding_re = re.compile(u'[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f\\\\]') def _cleanup_encoding_repl(m): c = m.group(0) return '\\\\' if c == '\\' else '\\x{:02X}'.format(ord(c)) From 7b205832d25937221e8e08ceb1faa82defa2db34 Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Fri, 7 Feb 2014 15:23:50 -0800 Subject: [PATCH 18/19] Bug 968956 - DMD: Acquire state lock before clearing reports. r=njn. DONTBUILD because DMD is NPOTB. --HG-- extra : rebase_source : c3e5b2f27d4983c5802f1a38c8accc31a2b07fa2 --- memory/replace/dmd/DMD.cpp | 44 +++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/memory/replace/dmd/DMD.cpp b/memory/replace/dmd/DMD.cpp index 5eeb775d1d20..c12125c9ae9c 100644 --- a/memory/replace/dmd/DMD.cpp +++ b/memory/replace/dmd/DMD.cpp @@ -1835,11 +1835,15 @@ Init(const malloc_table_t* aMallocTable) DMD_CREATE_TLS_INDEX(gTlsIndex); - gStackTraceTable = InfallibleAllocPolicy::new_(); - gStackTraceTable->init(8192); + { + AutoLockState lock; - gBlockTable = InfallibleAllocPolicy::new_(); - gBlockTable->init(8192); + gStackTraceTable = InfallibleAllocPolicy::new_(); + gStackTraceTable->init(8192); + + gBlockTable = InfallibleAllocPolicy::new_(); + gBlockTable->init(8192); + } if (gOptions->IsTestMode()) { // OpenOutputFile() can allocate. So do this before setting @@ -2012,12 +2016,13 @@ PrintSortedTraceAndFrameRecords(const Writer& aWriter, } // Note that, unlike most SizeOf* functions, this function does not take a -// |mozilla::MallocSizeOf| argument. That's because those arguments are primarily -// to aid DMD track heap blocks... but DMD deliberately doesn't track heap -// blocks it allocated for itself! +// |mozilla::MallocSizeOf| argument. That's because those arguments are +// primarily to aid DMD track heap blocks... but DMD deliberately doesn't track +// heap blocks it allocated for itself! // -// SizeOfInternal should be called while you're holding the state lock and while -// intercepts are blocked; SizeOf acquires the lock and blocks intercepts. +// SizeOfInternal should be called while you're holding the state lock and +// while intercepts are blocked; SizeOf acquires the lock and blocks +// intercepts. static void SizeOfInternal(Sizes* aSizes) @@ -2066,12 +2071,10 @@ SizeOf(Sizes* aSizes) SizeOfInternal(aSizes); } -MOZ_EXPORT void -ClearReports() +void +ClearReportsInternal() { - if (!gIsDMDRunning) { - return; - } + MOZ_ASSERT(gStateLock->IsLocked()); // Unreport all blocks that were marked reported by a memory reporter. This // excludes those that were reported on allocation, because they need to keep @@ -2081,6 +2084,17 @@ ClearReports() } } +MOZ_EXPORT void +ClearReports() +{ + if (!gIsDMDRunning) { + return; + } + + AutoLockState lock; + ClearReportsInternal(); +} + MOZ_EXPORT void Dump(Writer aWriter) { @@ -2270,7 +2284,7 @@ Dump(Writer aWriter) InfallibleAllocPolicy::delete_(locService); - ClearReports(); + ClearReportsInternal(); // Use internal version, we already have the lock. StatusMsg("}\n"); } From 153d4aef9a673f2ab560027a34fd40ae739a3253 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 5 Feb 2014 16:17:09 -0800 Subject: [PATCH 19/19] Bug 966864 - |mach valgrind-test|: Parse Valgrind output so that different errors are distinguished for TBPL. r=gps. --HG-- extra : rebase_source : de5bdf985c704e77ad1f9b4ab244d06141c92124 --- build/valgrind/__init__.py | 0 build/valgrind/mach_commands.py | 23 +++---- build/valgrind/output_handler.py | 105 +++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+), 13 deletions(-) create mode 100644 build/valgrind/__init__.py create mode 100644 build/valgrind/output_handler.py diff --git a/build/valgrind/__init__.py b/build/valgrind/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/build/valgrind/mach_commands.py b/build/valgrind/mach_commands.py index c17400fca9c1..2ce68502929a 100644 --- a/build/valgrind/mach_commands.py +++ b/build/valgrind/mach_commands.py @@ -5,6 +5,7 @@ from __future__ import print_function, unicode_literals import os +import re import subprocess from mach.decorators import ( @@ -42,7 +43,6 @@ class MachCommands(MachCommandBase): 'files.') def valgrind_test(self, suppressions): import json - import re import sys import tempfile @@ -53,6 +53,7 @@ class MachCommands(MachCommandBase): from mozprofile.permissions import ServerLocations from mozrunner import FirefoxRunner from mozrunner.utils import findInPath + from valgrind.output_handler import OutputHandler build_dir = os.path.join(self.topsrcdir, 'build') @@ -92,16 +93,6 @@ class MachCommands(MachCommandBase): env['MOZ_CRASHREPORTER_NO_REPORT'] = '1' env['XPCOM_DEBUG_BREAK'] = 'warn' - class OutputHandler(object): - def __init__(self): - self.found_errors = False - - def __call__(self, line): - print(line) - m = re.match(r'.*ERROR SUMMARY: [1-9]\d* errors from \d+ contexts', line) - if m: - self.found_errors = True - outputHandler = OutputHandler() kp_kwargs = {'processOutputLine': [outputHandler]} @@ -145,12 +136,18 @@ class MachCommands(MachCommandBase): exitcode = runner.wait() finally: - if not outputHandler.found_errors: + errs = outputHandler.error_count + supps = outputHandler.suppression_count + if errs != supps: + status = 1 # turns the TBPL job orange + print('TEST-UNEXPECTED-FAILURE | valgrind-test | error parsing:', errs, "errors seen, but", supps, "generated suppressions seen") + + elif errs == 0: status = 0 print('TEST-PASS | valgrind-test | valgrind found no errors') else: status = 1 # turns the TBPL job orange - print('TEST-UNEXPECTED-FAIL | valgrind-test | valgrind found errors') + # We've already printed details of the errors. if exitcode != 0: status = 2 # turns the TBPL job red diff --git a/build/valgrind/output_handler.py b/build/valgrind/output_handler.py new file mode 100644 index 000000000000..69d8e8d460c4 --- /dev/null +++ b/build/valgrind/output_handler.py @@ -0,0 +1,105 @@ +# 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/. + +from __future__ import print_function, unicode_literals + +import re + +class OutputHandler(object): + ''' + A class for handling Valgrind output. + + Valgrind errors look like this: + + ==60741== 40 (24 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 2,746 of 5,235 + ==60741== at 0x4C26B43: calloc (vg_replace_malloc.c:593) + ==60741== by 0x63AEF65: PR_Calloc (prmem.c:443) + ==60741== by 0x69F236E: PORT_ZAlloc_Util (secport.c:117) + ==60741== by 0x69F1336: SECITEM_AllocItem_Util (secitem.c:28) + ==60741== by 0xA04280B: ffi_call_unix64 (in /builds/slave/m-in-l64-valgrind-000000000000/objdir/toolkit/library/libxul.so) + ==60741== by 0xA042443: ffi_call (ffi64.c:485) + + For each such error, this class extracts most or all of the first (error + kind) line, plus the function name in each of the first few stack entries. + With this data it constructs and prints a TEST-UNEXPECTED-FAIL message that + TBPL will highlight. + + It buffers these lines from which text is extracted so that the + TEST-UNEXPECTED-FAIL message can be printed before the full error. + + Parsing the Valgrind output isn't ideal, and it may break in the future if + Valgrind changes the format of the messages, or introduces new error kinds. + To protect against this, we also count how many lines containing + "" are seen. Thanks to the use of + --gen-suppressions=yes, exactly one of these lines is present per error. If + the count of these lines doesn't match the error count found during + parsing, then the parsing has missed one or more errors and we can fail + appropriately. + ''' + + def __init__(self): + # The regexps in this list match all of Valgrind's errors. Note that + # Valgrind is English-only, so we don't have to worry about + # localization. + self.re_error = \ + r'==\d+== (' + \ + r'(Use of uninitialised value of size \d+)|' + \ + r'(Conditional jump or move depends on uninitialised value\(s\))|' + \ + r'(Syscall param .* contains uninitialised byte\(s\))|' + \ + r'(Syscall param .* points to (unaddressable|uninitialised) byte\(s\))|' + \ + r'((Unaddressable|Uninitialised) byte\(s\) found during client check request)|' + \ + r'(Invalid free\(\) / delete / delete\[\] / realloc\(\))|' + \ + r'(Mismatched free\(\) / delete / delete \[\])|' + \ + r'(Invalid (read|write) of size \d+)|' + \ + r'(Jump to the invalid address stated on the next line)|' + \ + r'(Source and destination overlap in .*)|' + \ + r'(.* bytes in .* blocks are .* lost)' + \ + r')' + # Match identifer chars, plus ':' for namespaces, and '\?' in order to + # match "???" which Valgrind sometimes produces. + self.re_stack_entry = r'^==\d+==.*0x[A-Z0-9]+: ([A-Za-z0_9_:\?]+)' + self.re_suppression = r' *' + self.error_count = 0 + self.suppression_count = 0 + self.number_of_stack_entries_to_get = 0 + self.curr_failure_msg = None + self.buffered_lines = None + + def __call__(self, line): + if self.number_of_stack_entries_to_get == 0: + # Look for the start of a Valgrind error. + m = re.search(self.re_error, line) + if m: + self.error_count += 1 + self.number_of_stack_entries_to_get = 4 + self.curr_failure_msg = 'TEST-UNEXPECTED-FAIL | valgrind-test | ' + m.group(1) + " at " + self.buffered_lines = [line] + else: + print(line) + + else: + # We've recently found a Valgrind error, and are now extracting + # details from the first few stack entries. + self.buffered_lines.append(line) + m = re.match(self.re_stack_entry, line) + if m: + self.curr_failure_msg += m.group(1) + else: + self.curr_failure_msg += '?!?' + + self.number_of_stack_entries_to_get -= 1 + if self.number_of_stack_entries_to_get != 0: + self.curr_failure_msg += ' / ' + else: + # We've finished getting the first few stack entries. Print the + # failure message and the buffered lines, and then reset state. + print('\n' + self.curr_failure_msg + '\n') + for b in self.buffered_lines: + print(b) + self.curr_failure_msg = None + self.buffered_lines = None + + if re.match(self.re_suppression, line): + self.suppression_count += 1 +