Web applications using JavaScript, objects returned from functions are missing properties when using the Microsoft Edge browser.

Male, Suresh 25 Reputation points
2025-01-24T09:06:07.8066667+00:00

Steps to reproduce the problem

  1. Open Microsoft Edge
  2. Navigate to any webpage
  3. open the JavaScript console
  4. Copy and paste the following code segment into the JavaScript console
        function make_obj() {
         var obj = ({});
         for(var i = 0; i < 4000000; ++i) obj[i + " " + i] = {idx: i};
         obj["!ref"] = 3;
         console.log(obj["!ref"]);
         return obj
       }
       
       
       var data = { Sheets: {}}; data.Sheets["abc"] = make_obj(); console.log(data.Sheets.abc["!ref"]);
    
    1. Press "Enter" or "Return" to evaluate

Problem Description:

The make_obj function returns a JavaScript object. The "!ref" property is assigned to the object.

The first console.log statement shows that the value is 3.

After calling the function, the second console.log statement inspects the same property. It is undefined.

Summary:

Objects returned from functions are losing properties

Note: (This issue has been fixed in chromium - https://issues.chromium.org/issues/390568195)

Thanks

Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
2,444 questions
0 comments No comments
{count} vote

Accepted answer
  1. ShiJieLi-MSFT 11,276 Reputation points Microsoft Vendor
    2025-01-27T02:56:14.7333333+00:00

    Hi @Male, Suresh,

    Thank you for your feedback. I can successfully reproduce this issue in Microsoft Edge.

    According to the Chromium issue thread, this issue is fixed in Canary. Based on my test, the fix is only available on Chrome Canary and Edge Canary (You can check the link to install Edge Canary for a test).

    This means Edge Stable will fix this issue in the next releases. For now, the workaround is to use Edge Canary or Chrome Canary. Thank you for your understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,

    Shijie Li

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.