Commit 6b21ce1b authored by Oana Pop Rus's avatar Oana Pop Rus
Browse files

Merge inbound to mozilla-central. a=merge

parents d2ad5c4e 199bb297
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ support-files =
  doc_markup_xul.xul
  doc_markup_update-on-navigtion_1.html
  doc_markup_update-on-navigtion_2.html
  doc_markup_view-original-source.html
  events_bundle.js
  events_bundle.js.map
  events_original.js
@@ -241,6 +242,7 @@ skip-if = (os == 'win' && processor == 'aarch64') # bug 1533507
[browser_markup_toggle_closing_tag_line.js]
[browser_markup_update-on-navigtion.js]
[browser_markup_view-source.js]
[browser_markup_view-original-source.js]
[browser_markup_void_elements_html.js]
[browser_markup_void_elements_xhtml.js]
[browser_markup_whitespace.js]
+48 −0
Original line number Diff line number Diff line
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

const TEST_URI = URL_ROOT + "doc_markup_view-original-source.html";

// Test that event handler links go to the right debugger source when the
// event handler is source mapped.
add_task(async function() {
  const { inspector, toolbox } = await openInspectorForURL(TEST_URI);

  const target = await TargetFactory.forTab(gBrowser.selectedTab);

  const nodeFront = await getNodeFront("#foo", inspector);
  const container = getContainerForNodeFront(nodeFront, inspector);

  const evHolder = container.elt.querySelector(
    ".inspector-badge.interactive[data-event]");

  evHolder.scrollIntoView();
  EventUtils.synthesizeMouseAtCenter(evHolder, {},
    inspector.markup.doc.defaultView);

  const tooltip = inspector.markup.eventDetailsTooltip;
  await tooltip.once("shown");
  await tooltip.once("event-tooltip-source-map-ready");

  const debuggerIcon = tooltip.panel.querySelector(".event-tooltip-debugger-icon");
  EventUtils.synthesizeMouse(debuggerIcon, 2, 2, {}, debuggerIcon.ownerGlobal);

  await gDevTools.showToolbox(target, "jsdebugger");
  const dbg = toolbox.getPanel("jsdebugger");

  let source;
  await BrowserTestUtils.waitForCondition(() => {
    source = dbg._selectors.getSelectedSource(dbg._getState());
    return !!source;
  }, "loaded source", 100, 20);

  is(
    source.url,
    "webpack:///events_original.js",
    "expected original source to be loaded"
  );
});
+9 −0
Original line number Diff line number Diff line
<body>
<button id="foo">Button</button>
<script src="events_bundle.js"></script>
<script>
"use strict";
var button = document.getElementById("foo");
button.addEventListener("click", window.init);
</script>
</body>
+3 −1
Original line number Diff line number Diff line
@@ -36,7 +36,9 @@ exports.viewSourceInStyleEditor = async function(toolbox, sourceURL,

/**
 * Tries to open a JavaScript file in the Debugger. If the file is not found,
 * it is opened in source view instead.
 * it is opened in source view instead. Either the source URL or source actor ID
 * can be specified. If both are specified, the source actor ID is used.
 *
 * Returns a promise resolving to a boolean indicating whether or not
 * the source was able to be displayed in the Debugger, as the built-in Firefox
 * View Source is the fallback.
+5 −0
Original line number Diff line number Diff line
@@ -111,6 +111,11 @@ EventTooltip.prototype = {
              const eventEditor = this._eventEditors.get(content);
              eventEditor.uri = newURI;

              // Since we just changed the URI/line, we need to clear out the
              // source actor ID. These must be consistent with each other when
              // we call viewSourceInDebugger with the event's information.
              eventEditor.sourceActor = null;

              // This is emitted for testing.
              this._tooltip.emit("event-tooltip-source-map-ready");
            }
Loading