简体   繁体   中英

Strange behaviour printing arguments from safari dev tools

I'm building an app with ionic. I've got this function declaration:

function calculate(origin, destination, mode, transitOptions, alternatives, onMap) {

  var request = buildRequest(arguments);

  var validationResult = validate(request);
  var deferred = $q.defer();
  .....

While debugging with chrome inspector on the android simulator I get this:

正确

The same call made on the iphone simulator and debugged with safari results in this:

很奇怪?

And of course the code breaks. Did anyone ever seen something like this?

I've never seen this before. It looks like arguments is being evaluated on a different call frame than the one where execution is paused. Based on the value of arguments[1] , it looks like it is being evaluated in a call frame that's internal to the Web Inspector implementation.

Normally, evaluating on the console while paused will evaluate the expression in the scope of the currently selected call frame. But, in your second screenshot you omitted the Scope Chain sidebar, so I can't really tell what the current call frame is.

It would also help to include version numbers of the software you are running (Safari, iOS Simulator). Are you able to reproduce this issue in a recent Safari Technology Preview release?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM