Closed Bug 1552453 Opened 7 months ago Closed 7 months ago

Breakpoint doesn't pause in file during page load

Categories

(DevTools :: Debugger, defect, P2)

68 Branch
defect

Tracking

(firefox-esr60 unaffected, firefox67 wontfix, firefox68 fixed, firefox69 fixed)

VERIFIED FIXED
Firefox 69
Tracking Status
firefox-esr60 --- unaffected
firefox67 --- wontfix
firefox68 --- fixed
firefox69 --- fixed

People

(Reporter: piotrpalek, Assigned: jlast)

References

(Blocks 1 open bug)

Details

(Keywords: regression, Whiteboard: [debugger-mvp])

Attachments

(2 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Firefox/68.0

Steps to reproduce:

Set a breakpoint, reloaded my app

Actual results:

The app loaded and didn't stop at the breakpoint

Expected results:

It should pause at the breakpoint
I should note the source maps don't load for a few seconds after the app loads.

hmm, this should work because we save the breakpoint's generated (bundle) location in the server. Can you give us some more details so that we can test it?

I can confirm this, it is happening since the betas for Firefox 67 started, on version 66 everything seems fine.
For me it is happening with SAP UI5 Fiori applications I am developing. As my apps are all restricted within our company's network I can't give you those as examples to reproduce.
However I could find a demo app from SAP to demonstrate the issue.
The URL is:
https://sapui5.hana.ondemand.com/test-resources/sap/ui/demoapps/demokit/rta/fiori-elements/test/index.html#masterDetail-display

After loading open the debugger. Open the file CustomFilter.controller.js from the path test-resources/sap -> ui/demoapps/demokit/rta/fiori-elements -> ext/controller

Set a breakpoint in line 12 (return sap.ui.controller...) and reload the page. The breakpoint should trigger, but it doesn't.
If you reproduce these steps in Chromium-Browsers or in Firefox v66 the breakpoint triggers.

The file is generated from the file Component-preload.js. The generated file seems to be not available when the code line is processed.

Thank you trefzerd, this SAP demo is great for testing – I was able to easily reproduce the issue.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
Priority: -- → P2

Hmm, it works on line 120 for me.

Summary: Breakpoint doesn't work during page load → Breakpoint doesn't pause in source mapped file during page load

This is AMD, not source maps.

Summary: Breakpoint doesn't pause in source mapped file during page load → Breakpoint doesn't pause in file during page load

Is that a recent regression? If it is, do we have a regression range? Is ESR affected? Thanks

I dug a bit more into this and it looks like the source is coming from an eval:

The full URL is (https://sapui5.hana.ondemand.com/test-resources/sap/ui/demoapps/demokit/rta/fiori-elements/ext/controller/CustomFilter.controller.js?eval)

And it is being initialized with SAP's custom module system in Component-preload.js line 3

sap.ui.predefine(
  "sap/ui/demoapps/rta/freestyle/ext/controller/CustomFilter.controller",
  [
    "sap/ui/model/Filter",
    "sap/m/Token",
    "sap/m/RatingIndicator",
    "sap/m/ComboBox",
    "sap/m/MultiInput",
    "sap/ui/comp/smartfilterbar/SmartFilterBar",
  ],
  function(F, T, R, C, M, S) {
    return sap.ui.controller(
      "sap.ui.demoapps.rta.fiorielements.ext.controller.CustomFilter"
      // stuff
    );
  }
);

Okay - a couple more pieces of information

  1. SAP uses this function execModule eval the module into existence. It is basically a glorified eval with content + sourceURL. I stepped through the code and it adds the sourceURL correctly which is why the tab appears in debugger correctly.
function execModule(sModuleName,bAsync){var oModule=mModules[sModuleName],oShim=mShims[sModuleName],bLoggable=log.isLoggable(),sOldPrefix,sScript,vAMD,oMatch,bOldForceSyncDefines;if(oModule&&oModule.state===LOADED&&typeof oModule.data!=="undefined"){vAMD=(oShim===true||(oShim&&oShim.amd))&&typeof __global.define==="function"&&__global.define.amd;bOldForceSyncDefines=bForceSyncDefines;try{if(vAMD){delete __global.define.amd;}bForceSyncDefines=!bAsync;if(bLoggable){log.debug(sLogPrefix+"executing '"+sModuleName+"'");sOldPrefix=sLogPrefix;sLogPrefix=sLogPrefix+": ";}oModule.state=EXECUTING;_execStack.push({name:sModuleName,used:false});if(typeof oModule.data==="function"){oModule.data.call(__global);}else if(Array.isArray(oModule.data)){ui5Define.apply(null,oModule.data);}else{sScript=oModule.data;if(sScript){oMatch=/\/\/[#@] source(Mapping)?URL=(.*)$/.exec(sScript);if(oMatch&&oMatch[1]&&/^[^/]+\.js\.map$/.test(oMatch[2])){sScript=sScript.slice(0,oMatch.index)+oMatch[0].slice(0,-oMatch[2].length)+resolveURL(oMatch[2],oModule.url);}if(!oMatch||oMatch[1]){sScript+="\n//# sourceURL="+resolveURL(oModule.url)+"?eval";}}if(typeof translate==="function"){sScript=translate(sScript,sModuleName);}if(__global.execScript&&(!oModule.data||oModule.data.length<MAX_EXEC_SCRIPT_LENGTH)){try{oModule.data&&__global.execScript(sScript);}catch(e){_execStack.pop();eval(oModule.data);throw e;}}else{__global.eval(sScript);}}_execStack.pop();queue.process(oModule);if(bLoggable){sLogPrefix=sOldPrefix;log.debug(sLogPrefix+"finished executing '"+sModuleName+"'");}}catch(err){if(bLoggable){sLogPrefix=sOldPrefix;}oModule.data=undefined;oModule.fail(err);}finally{if(vAMD){__global.define.amd=vAMD;}bForceSyncDefines=bOldForceSyncDefines;}}}

For some reason, the URL in addSource is still the URL of the eval though https://sapui5.hana.ondemand.com/resources/sap-ui-core.js.

Okay, I found the regression. In addSource we should be asking the sourceActor for the URL as opposed to the raw source.

Assignee: nobody → jlaster
Status: NEW → ASSIGNED
Whiteboard: [debugger-mvp]
Pushed by jlaster@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b0d23e155d87
Breakpoint doesnt pause in file during page load. r=loganfsmyth
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 69

Want to request uplift to beta?

Flags: in-testsuite+

Good idea. It should be easy to land as well.

Flags: needinfo?(jlaster)
Attached file the original patch should work (obsolete) —

Beta/Release Uplift Approval Request

  • User impact if declined: breakpoints associated with a source url pragma will not hit on reload
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): it only affects the debugger
  • String changes made/needed:
Attachment #9068187 - Flags: approval-mozilla-beta?
Attachment #9066745 - Flags: approval-mozilla-beta?
Comment on attachment 9068187 [details]
the original patch should work

I don't think we need a separate attachment here...
Attachment #9068187 - Attachment is obsolete: true
Attachment #9068187 - Flags: approval-mozilla-beta?

Comment on attachment 9066745 [details]
Bug 1552453 - Breakpoint doesnt pause in file during page load. r=loganfsmyth

debugger fix, approved for 68.0b6

Attachment #9066745 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Now that 68.0b6 landed I can confirm that the breakpoints in all my internal SAP applications work again as intended.
Thanks for the fast fixing!

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.