Closed Bug 1338558 Opened 7 years ago Closed 4 years ago

Debugger fails to load blob js files

Categories

(DevTools :: Debugger, defect, P5)

53 Branch
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1563512

People

(Reporter: damir.veapi+ff, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:51.0) Gecko/20100101 Firefox/51.0
Build ID: 20170125094131

Steps to reproduce:

I was trying to debug a Unity WebGL build, which is built as asm.js through Emscripten. Main assembly files are being loaded as blobs and when trying to view them in the debugger only an error appears. 

May be related to #1221148.

Steps to reproduce:

1) Unpack the attached archive
2) Run the example page from the archive
3) Open Developer Tools, go to Debugger
4) Try to view one of the 'blob://' files


Actual results:

An error apears:

Could not load the source for blob:http://localhost:58516/c53dacab-7150-4af7-862c-b3e110de05c7.
[Exception... "Failed to open input source 'file:////localhost:58516/c53dacab-7150-4af7-862c-b3e110de05c7'"  nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)"  location: "JS frame :: resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/DevToolsUtils.js :: mainThreadFetch :: line 518"  data: yes]
Stack: mainThreadFetch@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/DevToolsUtils.js:518:5
_getSourceText/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/source.js:393:27
process@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:917:23
walkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:801:7
Promise*scheduleWalkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:734:11
schedulePromise@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:765:7
Promise.prototype.then@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:450:5
onSource@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/actors/source.js:471:12
handler@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/protocol.js:1082:19
onPacket@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/server/main.js:1769:15
receiveMessage@resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/transport/transport.js:761:7
Line: 518, column: 0


Expected results:

JS code appears.
Component: Untriaged → Developer Tools: Debugger
:yury - curious what you think of this bug. 

It looks like this is an issue with the source actor onSource, getSourceText function.
Flags: needinfo?(ydelendik)
The blob object URL was destroyed at LoadJSCodeBlob function by revokeObjectURL (see Development/UnityLoader.js file from the attached code)

function LoadJSCodeBlob(blob, onload, blobInfo) {
        var script = document.createElement('script');
        var blobUrl = URL.createObjectURL(blob);
        if (blobInfo) {
                if (!Module.blobInfo)
                        Module.blobInfo = {};
                Module.blobInfo[blobUrl] = blobInfo;
        }
        script.src = blobUrl;
        script.onload = function() {
                URL.revokeObjectURL(blobUrl);
                if (onload)
                        onload();
        };
        document.body.appendChild(script);
}

Since the source of the JavaScript code destroyed, devtools has no way to retrieve the code. Removing the URL.revokeObjectURL(blobUrl) fixes the issue.
Flags: needinfo?(ydelendik)
Question related to this bug on SO: https://stackoverflow.com/q/44874083/3367974
Product: Firefox → DevTools
Blocks: dbg-sources
Priority: -- → P5
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: