Bug 1379585 part 2 - Disable interrupt callback when doing pattern matching. r?baku
MozReview-Commit-ID: 86VY6ZCtpew
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -7159,19 +7159,18 @@ ReportPatternCompileFailure(nsAString& a
// static
bool
nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
nsIDocument* aDocument)
{
NS_ASSERTION(aDocument, "aDocument should be a valid pointer (not null)");
- AutoJSAPI jsapi;
- jsapi.Init();
- JSContext* cx = jsapi.cx();
+ AutoJSContext cx;
+ AutoDisableJSInterruptCallback disabler(cx);
// We can use the junk scope here, because we're just using it for
// regexp evaluation, not actual script execution.
JSAutoCompartment ac(cx, xpc::UnprivilegedJunkScope());
// The pattern has to match the entire value.
aPattern.Insert(NS_LITERAL_STRING("^(?:"), 0);
aPattern.AppendLiteral(")$");