Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.79 KB | None | 0 0
  1. diff --git a/devtools/client/debugger/src/actions/navigation.js b/devtools/client/debugger/src/actions/navigation.js
  2. index a6ed37c7b03d..3e519cd071c2 100644
  3. --- a/devtools/client/debugger/src/actions/navigation.js
  4. +++ b/devtools/client/debugger/src/actions/navigation.js
  5. @@ -48,7 +48,7 @@ export function willNavigate(event: Object) {
  6. export function connect(
  7. url: string,
  8. actor: string,
  9. - canRewind: boolean,
  10. + traits,
  11. isWebExtension: boolean
  12. ) {
  13. return async function({ dispatch }: ThunkArgs) {
  14. @@ -62,7 +62,7 @@ export function connect(
  15. type: "mainThread",
  16. name: L10N.getStr("mainThread"),
  17. },
  18. - canRewind,
  19. + traits,
  20. isWebExtension,
  21. }: Action)
  22. );
  23. diff --git a/devtools/client/debugger/src/actions/sources/newSources.js b/devtools/client/debugger/src/actions/sources/newSources.js
  24. index f10bbcf7aa3f..6fe2dd473605 100644
  25. --- a/devtools/client/debugger/src/actions/sources/newSources.js
  26. +++ b/devtools/client/debugger/src/actions/sources/newSources.js
  27. @@ -291,7 +291,6 @@ export function newGeneratedSources(sourceInfo: Array<GeneratedSourceData>) {
  28. getState,
  29. client,
  30. }: ThunkArgs): Promise<Array<Source>> => {
  31. - const supportsWasm = client.hasWasmSupport();
  32.  
  33. const resultIds = [];
  34. const newSourcesObj = {};
  35. @@ -310,7 +309,7 @@ export function newGeneratedSources(sourceInfo: Array<GeneratedSourceData>) {
  36. introductionUrl: source.introductionUrl,
  37. introductionType: source.introductionType,
  38. isBlackBoxed: false,
  39. - isWasm: !!supportsWasm && source.introductionType === "wasm",
  40. + isWasm: !!supportsWasm(getState()) && source.introductionType === "wasm",
  41. isExtension: (source.url && isUrlExtension(source.url)) || false,
  42. };
  43. }
  44. diff --git a/devtools/client/debugger/src/client/firefox.js b/devtools/client/debugger/src/client/firefox.js
  45. index d79c76f2b797..24db2e5033d5 100644
  46. --- a/devtools/client/debugger/src/client/firefox.js
  47. +++ b/devtools/client/debugger/src/client/firefox.js
  48. @@ -25,14 +25,10 @@ export async function onConnect(connection: any, actions: Object) {
  49. return;
  50. }
  51.  
  52. - const supportsWasm =
  53. - features.wasm && !!debuggerClient.mainRoot.traits.wasmBinarySource;
  54. -
  55. setupCommands({
  56. threadFront,
  57. tabTarget,
  58. debuggerClient,
  59. - supportsWasm,
  60. });
  61.  
  62. setupEvents({ threadFront, tabTarget, actions, supportsWasm });
  63. @@ -59,7 +55,7 @@ export async function onConnect(connection: any, actions: Object) {
  64. await actions.connect(
  65. tabTarget.url,
  66. threadFront.actor,
  67. - traits && traits.canRewind,
  68. + traits,
  69. tabTarget.isWebExtension
  70. );
  71.  
  72. diff --git a/devtools/client/debugger/src/client/firefox/commands.js b/devtools/client/debugger/src/client/firefox/commands.js
  73. index 7daea96bc12e..0c7fe3b256b0 100644
  74. --- a/devtools/client/debugger/src/client/firefox/commands.js
  75. +++ b/devtools/client/debugger/src/client/firefox/commands.js
  76. @@ -48,29 +48,22 @@ let debuggerClient: DebuggerClient;
  77. let sourceActors: { [ActorId]: SourceId };
  78. let breakpoints: { [string]: Object };
  79. let eventBreakpoints: ?EventListenerActiveList;
  80. -let supportsWasm: boolean;
  81.  
  82. type Dependencies = {
  83. threadFront: ThreadFront,
  84. tabTarget: Target,
  85. debuggerClient: DebuggerClient,
  86. - supportsWasm: boolean,
  87. };
  88.  
  89. function setupCommands(dependencies: Dependencies) {
  90. currentThreadFront = dependencies.threadFront;
  91. currentTarget = dependencies.tabTarget;
  92. debuggerClient = dependencies.debuggerClient;
  93. - supportsWasm = dependencies.supportsWasm;
  94. targets = { worker: {}, contentProcess: {} };
  95. sourceActors = {};
  96. breakpoints = {};
  97. }
  98.  
  99. -function hasWasmSupport() {
  100. - return supportsWasm;
  101. -}
  102. -
  103. function createObjectClient(grip: Grip) {
  104. return debuggerClient.createObjectClient(grip);
  105. }
  106. @@ -589,7 +582,6 @@ const clientCommands = {
  107. setEventListenerBreakpoints,
  108. getEventListenerBreakpointTypes,
  109. detachWorkers,
  110. - hasWasmSupport,
  111. lookupTarget,
  112. };
  113.  
  114. diff --git a/devtools/client/debugger/src/reducers/pause.js b/devtools/client/debugger/src/reducers/pause.js
  115. index 226e20ca2881..ce271243e89b 100644
  116. --- a/devtools/client/debugger/src/reducers/pause.js
  117. +++ b/devtools/client/debugger/src/reducers/pause.js
  118. @@ -91,7 +91,6 @@ type ThreadPauseState = {
  119. export type PauseState = {
  120. cx: Context,
  121. threadcx: ThreadContext,
  122. - canRewind: boolean,
  123. threads: { [ThreadId]: ThreadPauseState },
  124. skipPausing: boolean,
  125. mapScopes: boolean,
  126. @@ -113,7 +112,6 @@ function createPauseState(thread: ThreadId = "UnknownThread") {
  127. },
  128. previewLocation: null,
  129. threads: {},
  130. - canRewind: false,
  131. skipPausing: prefs.skipPausing,
  132. mapScopes: prefs.mapScopes,
  133. shouldPauseOnExceptions: prefs.pauseOnExceptions,
  134. @@ -136,7 +134,6 @@ const resumedPauseState = {
  135. const createInitialPauseState = () => ({
  136. ...resumedPauseState,
  137. isWaitingOnBreak: false,
  138. - canRewind: false,
  139. command: null,
  140. lastCommand: null,
  141. previousLocation: null,
  142. @@ -279,7 +276,6 @@ function update(
  143. case "CONNECT":
  144. return {
  145. ...createPauseState(action.mainThread.actor),
  146. - canRewind: action.canRewind,
  147. };
  148.  
  149. case "PAUSE_ON_EXCEPTIONS": {
  150. @@ -485,10 +481,6 @@ export function getShouldPauseOnCaughtExceptions(state: State) {
  151. return state.pause.shouldPauseOnCaughtExceptions;
  152. }
  153.  
  154. -export function getCanRewind(state: State) {
  155. - return state.pause.canRewind;
  156. -}
  157. -
  158. export function getFrames(state: State, thread: ThreadId) {
  159. return getThreadPauseState(state.pause, thread).frames;
  160. }
  161. diff --git a/devtools/client/debugger/src/reducers/threads.js b/devtools/client/debugger/src/reducers/threads.js
  162. index 4e2ae25635cd..b3bef6516f78 100644
  163. --- a/devtools/client/debugger/src/reducers/threads.js
  164. +++ b/devtools/client/debugger/src/reducers/threads.js
  165. @@ -25,6 +25,7 @@ export type ThreadsState = {
  166. export function initialThreadsState(): ThreadsState {
  167. return {
  168. threads: [],
  169. + traits: {},
  170. mainThread: {
  171. actor: "",
  172. url: "",
  173. @@ -44,6 +45,7 @@ export default function update(
  174. return {
  175. ...state,
  176. mainThread: action.mainThread,
  177. + traits, action.traits,
  178. isWebExtension: action.isWebExtension,
  179. };
  180. case "INSERT_THREADS":
  181. @@ -92,6 +94,16 @@ export const getAllThreads: Selector<Thread[]> = createSelector(
  182. ]
  183. );
  184.  
  185. +
  186. +export function getCanRewind(state: State) {
  187. + return state.threads.traits.canRewind;
  188. +}
  189. +
  190. +export function supportsWasm(state: State) {
  191. + return features.wasm && state.threads.traits.wasmBinarySource;
  192. +}
  193. +
  194. +
  195. // checks if a path begins with a thread actor
  196. // e.g "server1.conn0.child1/workerTarget22/context1/dbg-workers.glitch.me"
  197. export function startsWithThreadActor(state: State, path: string) {
  198. @@ -101,4 +113,8 @@ export function startsWithThreadActor(state: State, path: string) {
  199. return match && match[1];
  200. }
  201.  
  202. +
  203. +
  204. type OuterState = { threads: ThreadsState };
  205. +
  206. +
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement