event-breakpoints.js (935B)
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 7 const { 8 STATES: THREAD_STATES, 9 } = require("resource://devtools/server/actors/thread.js"); 10 11 module.exports = { 12 async addOrSetSessionDataEntry( 13 targetActor, 14 entries, 15 isDocumentCreation, 16 updateType 17 ) { 18 const { threadActor } = targetActor; 19 // The thread actor has to be initialized in order to have functional breakpoints 20 if (threadActor.state == THREAD_STATES.DETACHED) { 21 threadActor.attach(); 22 } 23 if (updateType == "set") { 24 threadActor.setActiveEventBreakpoints(entries); 25 } else { 26 threadActor.addEventBreakpoints(entries); 27 } 28 }, 29 30 removeSessionDataEntry(targetActor, entries) { 31 targetActor.threadActor.removeEventBreakpoints(entries); 32 }, 33 };