Chrome DevTools error: “Failed to save to temp variable.”

后端 未结 2 1773
夕颜
夕颜 2021-02-04 23:56

I am using Node Monkey to debug my NodeJS app.

It happens frequently that when I click \"Store as Global Variable\" in my Chrome Console it says \"Failed to save to temp

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-05 00:25

    I can see two reasons why Store As Global Variable wouldn't work:

    1. Wrong Console Context Selected

    This is arguably a Chrome bug, but you can only store an object as a global if the console is set to the same context as the code that logged the object.

    In practice this means you might need to select the correct IFrame or web worker.

    For example, on jsFiddle:

    In the normal jsFiddle editor page context I'm getting an error. But it works if I change the context to the contents of the fiddle itself:

    2. Garbage Collection

    In order for Chrome to give you a reference to the object the object still has to be in memory. If that isn't the case it can only throw an error.

    However, I'm pretty sure that being shown in the console forces V8 to keep a reference to the value.

提交回复
热议问题