Closed Bug 1634454 Opened 5 years ago Closed 4 years ago

Promise-backend.js fails to load on Windows if it's a symlink

Categories

(Core :: XPCOM, task)

x86_64
Windows 10
task

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: saschanaz, Assigned: saschanaz)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

  1. Build Gecko
  2. Run ./mach xpcshell-test netwerk/test/unit/test_resumable_channel.js and check it succeeds
  3. Replace obj-x86_64-pc-mingw32\dist\bin\modules\Promise-backend.js with a symlink to toolkit\modules\Promise-backend.js.
  4. Run step 2 again

Expected: It should also succeed
Actual: It does not, the failure log says:

pid:17812 JavaScript error: resource://testing-common/PromiseTestUtils.jsm, line 70: TypeError: can't access property "Debugging", JSMPromise is undefined

Since 1) Promise.jsm loads Promise-backend.js via mozJSSubScriptLoader 2) Promise.jsm itself runs as expected (try adding throw new Error there), I think it's a problem in mozJSSubScriptLoader.

Further debugging says NS_ReadInputStreamToString inside mozJSSubScriptLoader::ReadScript reads a zero-length string.

Sigh. During further digging I found that nsLocalFileWin has a total misunderstanding of Windows symlinks. An .lnk file is a shortcut, not a symlink.

Remember that Gecko has more than 20-years history. When nsIFile was implemented, Windows had no symlink support and Mozilla decided to treat .lnk files as symlinks.

To fix this bug, nsLocalFile::GetFileSize should support (native NTFS) symlinks.

Unrelated to the JS engine. Moving to XPCOM based on comment 4.

Component: JavaScript Engine → XPCOM
Assignee: nobody → krosylight
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: