Bug 1379585 part 2 - Disable interrupt callback when doing pattern matching. r?baku draft
authorXidorn Quan <me@upsuper.org>
Fri, 14 Jul 2017 10:03:43 +1000
changeset 608832 f8c9f353c22350c199c5dd7f80cec4a94c708db0
parent 608831 d69ae4fc18e2765d420692ea973c3ec5bf044910
child 637421 ce975b7b03436ede2ee03bd82fde4fdd9f058ab1
push id68412
push userxquan@mozilla.com
push dateFri, 14 Jul 2017 06:56:30 +0000
reviewersbaku
bugs1379585
milestone56.0a1
Bug 1379585 part 2 - Disable interrupt callback when doing pattern matching. r?baku MozReview-Commit-ID: 86VY6ZCtpew
dom/base/nsContentUtils.cpp
--- 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(")$");