tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_dbg-ember-original-variable-mapping-notifications.js (2410B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
      4 
      5 "use strict";
      6 // Tests pausing in original sources from projects built on ember framework,
      7 // This also tests the original variable mapping toggle and notifications
      8 
      9 add_task(async function () {
     10  const dbg = await initDebugger("ember/quickstart/dist/");
     11 
     12  await invokeWithBreakpoint(
     13    dbg,
     14    "mapTestFunction",
     15    "router.js",
     16    { line: 13, column: 3 },
     17    async () => {
     18      info("Assert the original variable mapping notifications are visible");
     19      is(
     20        getScopeNotificationMessage(dbg),
     21        DEBUGGER_L10N.getFormatStr(
     22          "scopes.noOriginalScopes",
     23          DEBUGGER_L10N.getStr("scopes.showOriginalScopes")
     24        ),
     25        "Original mapping is disabled so the scopes notification is visible"
     26      );
     27 
     28      // Open the expressions pane
     29      let notificationText;
     30      const notificationVisible = waitUntil(() => {
     31        notificationText = getExpressionNotificationMessage(dbg);
     32        return notificationText;
     33      });
     34      await toggleExpressions(dbg);
     35      await notificationVisible;
     36 
     37      is(
     38        notificationText,
     39        DEBUGGER_L10N.getStr("expressions.noOriginalScopes"),
     40        "Original mapping is disabled so the expressions notification is visible"
     41      );
     42 
     43      await toggleMapScopes(dbg);
     44 
     45      info(
     46        "Assert the original variable mapping notifications no longer visible"
     47      );
     48      ok(
     49        !getScopeNotificationMessage(dbg),
     50        "Original mapping is enabled so the scopes notification is no longer visible"
     51      );
     52      ok(
     53        !getScopeNotificationMessage(dbg),
     54        "Original mapping is enabled so the expressions notification is no longer visible"
     55      );
     56 
     57      await assertScopes(dbg, [
     58        "Module",
     59        ["config", "{\u2026}"],
     60        "EmberRouter:Class()",
     61        "Router:Class()",
     62      ]);
     63    },
     64    { shouldWaitForLoadedScopes: false }
     65  );
     66 });
     67 
     68 function getScopeNotificationMessage(dbg) {
     69  return dbg.win.document.querySelector(
     70    ".scopes-pane .pane-info.no-original-scopes-info"
     71  )?.innerText;
     72 }
     73 
     74 function getExpressionNotificationMessage(dbg) {
     75  return dbg.win.document.querySelector(
     76    ".watch-expressions-pane .pane-info.no-original-scopes-info"
     77  )?.innerText;
     78 }