breakpoints.js (1615B)
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 import { createLocation } from "../../../utils/location"; 6 7 export function mockPendingBreakpoint(overrides = {}) { 8 const { sourceUrl, line, column, condition, disabled, hidden } = overrides; 9 return { 10 location: { 11 sourceUrl: sourceUrl || "http://localhost:8000/examples/bar.js", 12 line: line || 5, 13 column: column || 1, 14 }, 15 generatedLocation: { 16 sourceUrl: sourceUrl || "http://localhost:8000/examples/bar.js", 17 line: line || 5, 18 column: column || 1, 19 }, 20 astLocation: { 21 name: undefined, 22 offset: { 23 line: line || 5, 24 }, 25 index: 0, 26 }, 27 options: { 28 condition: condition || null, 29 hidden: hidden || false, 30 }, 31 disabled: disabled || false, 32 }; 33 } 34 35 export function generateBreakpoint(filename, line = 5, column = 0) { 36 return { 37 id: "breakpoint", 38 originalText: "", 39 text: "", 40 location: createLocation({ 41 source: { 42 url: `http://localhost:8000/examples/${filename}`, 43 id: filename, 44 }, 45 sourceId: filename, 46 line, 47 column, 48 }), 49 generatedLocation: createLocation({ 50 source: { 51 url: `http://localhost:8000/examples/${filename}`, 52 id: filename, 53 }, 54 sourceId: filename, 55 line, 56 column, 57 }), 58 astLocation: undefined, 59 options: { 60 condition: "", 61 hidden: false, 62 }, 63 disabled: false, 64 }; 65 }