Bug 1529680 - [release 127] Modified the Angular regex (#7950). r=dwalsh
authorJaril <jarilvalenciano@gmail.com>
Mon, 25 Feb 2019 09:59:47 -0500
changeset 518964 71adfc4d2e58ba2fc20dbece687005e7f6dad441
parent 518963 ba061047b9a0349d86f79834659f5b87f988958e
child 518965 049f4a9c8486e9b9bd8cb54513688bd86abb2084
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdwalsh
bugs1529680
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1529680 - [release 127] Modified the Angular regex (#7950). r=dwalsh
devtools/client/debugger/new/src/utils/pause/frames/getLibraryFromUrl.js
devtools/client/debugger/new/src/utils/pause/frames/tests/annotateFrames.spec.js
devtools/client/debugger/new/src/utils/pause/frames/tests/getLibraryFromUrl.spec.js
--- a/devtools/client/debugger/new/src/utils/pause/frames/getLibraryFromUrl.js
+++ b/devtools/client/debugger/new/src/utils/pause/frames/getLibraryFromUrl.js
@@ -73,17 +73,17 @@ const libraryMap = [
     pattern: /vue(?:\.[a-z]+)*\.js/i
   },
   {
     label: "RxJS",
     pattern: /rxjs/i
   },
   {
     label: "Angular",
-    pattern: /angular/i,
+    pattern: /angular(?!.*\/app\/)/i,
     contextPattern: /(zone\.js)/
   },
   {
     label: "Redux",
     pattern: /redux/i
   },
   {
     label: "Dojo",
--- a/devtools/client/debugger/new/src/utils/pause/frames/tests/annotateFrames.spec.js
+++ b/devtools/client/debugger/new/src/utils/pause/frames/tests/annotateFrames.spec.js
@@ -6,17 +6,17 @@
 
 import { annotateFrames } from "../annotateFrames";
 import { makeMockFrameWithURL } from "../../../test-mockup";
 
 describe("annotateFrames", () => {
   it("should return Angular", () => {
     const callstack = [
       makeMockFrameWithURL(
-        "https://cdnjs.cloudflare.com/ajax/libs/angular/angular.js"
+        "https://stackblitz.io/turbo_modules/@angular/core@7.2.4/bundles/core.umd.js"
       ),
       makeMockFrameWithURL("/node_modules/zone/zone.js"),
       makeMockFrameWithURL(
         "https://cdnjs.cloudflare.com/ajax/libs/angular/angular.js"
       )
     ];
     const frames = annotateFrames(callstack);
     expect(frames).toEqual(callstack.map(f => ({ ...f, library: "Angular" })));
--- a/devtools/client/debugger/new/src/utils/pause/frames/tests/getLibraryFromUrl.spec.js
+++ b/devtools/client/debugger/new/src/utils/pause/frames/tests/getLibraryFromUrl.spec.js
@@ -64,30 +64,53 @@ describe("getLibraryFromUrl", () => {
       ];
       reactUrlList.forEach(reactUrl => {
         const frame = makeMockFrameWithURL(reactUrl);
         expect(getLibraryFromUrl(frame)).toEqual("React");
       });
     });
   });
 
+  describe("When Angular is in the URL", () => {
+    it("should return Angular for AngularJS (1.x)", () => {
+      const frame = makeMockFrameWithURL(
+        "https://cdnjs.cloudflare.com/ajax/libs/angular/angular.js"
+      );
+      expect(getLibraryFromUrl(frame)).toEqual("Angular");
+    });
+
+    it("should return Angular for Angular (2.x)", () => {
+      const frame = makeMockFrameWithURL(
+        "https://stackblitz.io/turbo_modules/@angular/core@7.2.4/bundles/core.umd.js"
+      );
+      expect(getLibraryFromUrl(frame)).toEqual("Angular");
+    });
+
+    it("should not return Angular for Angular components", () => {
+      const frame = makeMockFrameWithURL(
+        "https://firefox-devtools-angular-log.stackblitz.io/~/src/app/hello.component.ts"
+      );
+      expect(getLibraryFromUrl(frame)).toBeNull();
+    });
+  });
+
   describe("When zone.js is on the frame", () => {
     it("should not return Angular when no callstack", () => {
       const frame = makeMockFrameWithURL("/node_modules/zone/zone.js");
       expect(getLibraryFromUrl(frame)).toEqual(null);
     });
 
     it("should not return Angular when stack without Angular frames", () => {
       const frame = makeMockFrameWithURL("/node_modules/zone/zone.js");
       const callstack = [frame];
 
       expect(getLibraryFromUrl(frame, callstack)).toEqual(null);
     });
 
-    it("should return Angular when stack with Angular frames", () => {
+    it("should return Angular when stack with AngularJS (1.x) frames", () => {
       const frame = makeMockFrameWithURL("/node_modules/zone/zone.js");
       const callstack = [
         frame,
         makeMockFrameWithURL(
           "https://cdnjs.cloudflare.com/ajax/libs/angular/angular.js"
         )
       ];