Skip to content

Commit

Permalink
Backed out changeset 2a4ee9f86e5a (bug 1862199) for causing bc failur…
Browse files Browse the repository at this point in the history
…es on browser_misused_characters_in_strings.js. CLOSED TREE
  • Loading branch information
Iulian Moraru committed Jun 4, 2024
1 parent a84174a commit a4f0216
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 59 deletions.
17 changes: 5 additions & 12 deletions dom/base/nsContentUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7230,19 +7230,9 @@ nsContentUtils::FindInternalDocumentViewer(const nsACString& aType,
}

static void ReportPatternCompileFailure(nsAString& aPattern,
const JS::RegExpFlags& aFlags,
const Document* aDocument,
JS::MutableHandle<JS::Value> error,
JSContext* cx) {
AutoTArray<nsString, 3> strings;

strings.AppendElement(aPattern);

std::stringstream flag_ss;
flag_ss << aFlags;
nsString* flagstr = strings.AppendElement();
AppendUTF8toUTF16(flag_ss.str(), *flagstr);

JS::AutoSaveExceptionState savedExc(cx);
JS::Rooted<JSObject*> exnObj(cx, &error.toObject());
JS::Rooted<JS::Value> messageVal(cx);
Expand All @@ -7251,13 +7241,16 @@ static void ReportPatternCompileFailure(nsAString& aPattern,
}
JS::Rooted<JSString*> messageStr(cx, messageVal.toString());
MOZ_ASSERT(messageStr);

AutoTArray<nsString, 2> strings;
strings.AppendElement(aPattern);
if (!AssignJSString(cx, *strings.AppendElement(), messageStr)) {
return;
}

nsContentUtils::ReportToConsole(nsIScriptError::errorFlag, "DOM"_ns,
aDocument, nsContentUtils::eDOM_PROPERTIES,
"PatternAttributeCompileFailurev2", strings);
"PatternAttributeCompileFailure", strings);
savedExc.drop();
}

Expand Down Expand Up @@ -7291,7 +7284,7 @@ Maybe<bool> nsContentUtils::IsPatternMatching(const nsAString& aValue,
}

if (!error.isUndefined()) {
ReportPatternCompileFailure(aPattern, aFlags, aDocument, &error, cx);
ReportPatternCompileFailure(aPattern, aDocument, &error, cx);
return Some(true);
}

Expand Down
2 changes: 0 additions & 2 deletions dom/base/test/mochitest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1485,8 +1485,6 @@ scheme = "https"

["test_reentrant_flush.html"]

["test_reportPatternFailure.html"]

["test_root_iframe.html"]

["test_sandbox_and_document_uri.html"]
Expand Down
40 changes: 0 additions & 40 deletions dom/base/test/test_reportPatternFailure.html

This file was deleted.

3 changes: 1 addition & 2 deletions dom/locales/en-US/chrome/dom/dom.properties
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ ManifestImageUnusable=%1$S item at index %2$S lacks a usable purpose. It will be
ManifestImageUnsupportedPurposes=%1$S item at index %2$S includes unsupported purpose(s): %3$S.
# LOCALIZATION NOTE: %1$S is the name of the parent property that has a repeated purpose (e.g., "icons"). %2$S is the index of the image object that has the repeated purpose (from 0). %3$S is the repeated purposes. E.g. "icons item at index 2 includes repeated purpose(s): a b."
ManifestImageRepeatedPurposes=%1$S item at index %2$S includes repeated purpose(s): %3$S.
# LOCALIZATION NOTE: %1$S is the regexp pattern, %2$S the regexp flags, %3$S the error message. Do not translate <input pattern>
PatternAttributeCompileFailurev2=Unable to check <input pattern='%1$S'> because ‘/%1$S/%2$S’ is not a valid regexp: %3$S
PatternAttributeCompileFailure=Unable to check <input pattern='%S'> because the pattern is not a valid regexp: %S
# LOCALIZATION NOTE: Do not translate "postMessage" or DOMWindow. %S values are origins, like https://domain.com:port
TargetPrincipalDoesNotMatch=Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘%S’) does not match the recipient window’s origin (‘%S’).
# LOCALIZATION NOTE: Do not translate 'YouTube'. %S values are origins, like https://domain.com:port
Expand Down
3 changes: 0 additions & 3 deletions js/src/vm/RegExpObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,6 @@ void ForEachRegExpFlag(JS::RegExpFlags flags, KnownF known, UnknownF unknown) {
case RegExpFlag::Unicode:
known("Unicode", "u");
break;
case RegExpFlag::UnicodeSets:
known("UnicodeSets", "v");
break;
case RegExpFlag::Sticky:
known("Sticky", "y");
break;
Expand Down

0 comments on commit a4f0216

Please sign in to comment.