Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#14115 closed defect (fixed)

[patch][cla]use module.url for hint to vm.runInThisContext

Reported by: ben hockey Owned by: Rawld Gill
Priority: high Milestone: 1.7.2
Component: Loader Version: 1.7.0b1
Keywords: Cc:
Blocked By: Blocking:

Description

in node.js the url hint that is passed to vm.runInThisContext needs to be the full path to the file url in order for breakpoints to work in "visual" debuggers such as cloud9. changing the hint passed to require.eval to be module.url rather than module.id fixes this. this also causes the browser debuggers that use ////@ sourceURL= to show the url rather than the module id - i could argue both ways as to which one is better in that case.

this patch would fix it:

  • dojo.js

     
    12121212                                               if(text===cached){
    12131213                                                       cached.call(null);
    12141214                                               }else{
    1215                                                        req.eval(text, module.mid);
     1215                                                       req.eval(text, module.url);
    12161216                                               }
    12171217                                       }catch(e){
    12181218                                               signal(error, makeError("evalModuleThrew", module));
     
    12211221                                       if(text===cached){
    12221222                                               cached.call(null);
    12231223                                       }else{
    1224                                                req.eval(text, module.mid);
     1224                                               req.eval(text, module.url);
    12251225                                       }
    12261226                               }
    12271227                               injectingCachedModule = 0;

Change History (8)

comment:1 Changed 6 years ago by ben hockey

Summary: use module.url for hint to vm.runInThisContext[patch][cla]use module.url for hint to vm.runInThisContext

comment:2 Changed 6 years ago by Rawld Gill

Status: newassigned

comment:3 Changed 6 years ago by Rawld Gill

Milestone: tbd1.8

comment:4 Changed 6 years ago by Rawld Gill

Resolution: fixed
Status: assignedclosed

In [27836]:

improved debugging hint for node; thanks neonstalwart; fixes #14115; !strict

comment:5 Changed 6 years ago by Rawld Gill

in [27836], added the has feature "dojo-loader-eval-hint-url"`, which, when truthy, will cause the module url to be used for the eval hint in the loader. This feature defaults to true for node and false for other environments (it seems the module id is easier to use in the browser), but, of course, can be hard-set by a user if they prefer one or the other.

By using a has feature, the builder can strip this code to save a few bytes.

comment:6 Changed 6 years ago by Rawld Gill

In [27837]:

make dojo-loader-eval-hint-url overrideable by user config; refs #14115; !strict

comment:7 Changed 6 years ago by Rawld Gill

In [27838]:

backport #14115 fixes; !strict; refs #14115

comment:8 Changed 6 years ago by bill

Milestone: 1.81.7.2
Note: See TracTickets for help on using tickets.