TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode dexie.js

▼魔方 西西 提交于 2019-12-05 22:47:17

问题


Can any one tell me what happen here when i call count() function of dexie.js:

TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
    at eval (eval at getErrorWithStack (http://127.0.0.1:8081/elements/js/dexie.js:394:5), <anonymous>:1:19)
    at getErrorWithStack (http://127.0.0.1:8081/elements/js/dexie.js:394:5)
    at new Promise (http://127.0.0.1:8081/elements/js/dexie.js:786:29)
    at new Transaction (http://127.0.0.1:8081/elements/js/dexie.js:2756:28)
    at Dexie._createTransaction (http://127.0.0.1:8081/elements/js/dexie.js:1809:16)
    at tempTransaction (http://127.0.0.1:8081/elements/js/dexie.js:1825:28)
    at WriteableTable.getIDBObjectStore (http://127.0.0.1:8081/elements/js/dexie.js:2266:99)
    at WriteableCollection._read (http://127.0.0.1:8081/elements/js/dexie.js:3454:42)
    at WriteableCollection.count (http://127.0.0.1:8081/elements/js/dexie.js:3510:33)
    at HTMLElement.checkLoadEnoughtOfflineData (http://127.0.0.1:8081/elements/base/app-localize-behavior.html:294:73)

The last line above is call from my function:

 checkLoadEnoughtOfflineData(idcheck) {
       return dbOffline.checkPageTable.where("idCheck").equals(idcheck).count();
    }

p/s: I'm working with Google Chorm 62.


回答1:


I assume you're debugger breaks at this location. It's a piece of code that intentionally breaks the "strict" mode rule in order to generate an error so that the call stack can be picked from the resulting error. If you can ignore this error type in the debugger settings, chromium debugger will stop annoying you with it. It will only happen if Dexie.debug === true (which is the default for sites served from localhost). The feature you get in your console log, is an async stack trace of unhandled rejections. You can explicitely turn it off by setting Dexie.debug = false.

The source looks like this:

export function getErrorWithStack() {
    "use strict";
    if (NEEDS_THROW_FOR_STACK) try {
        // Doing something naughty in strict mode here to trigger a specific error
        // that can be explicitely ignored in debugger's exception settings.
        // If we'd just throw new Error() here, IE's debugger's exception settings
        // will just consider it as "exception thrown by javascript code" which is
        // something you wouldn't want it to ignore.
        getErrorWithStack.arguments;
        throw new Error(); // Fallback if above line don't throw.
    } catch(e) {
        return e;
    }
    return new Error();
}


来源:https://stackoverflow.com/questions/47615114/typeerror-caller-callee-and-arguments-properties-may-not-be-accessed-on

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!