Opened 9 years ago
Closed 5 years ago
#14440 closed defect (fixed)
[regression] "use strict" issue with FireFox and ASP.NET
Reported by: | jbest | Owned by: | Kris Zyp |
---|---|---|---|
Priority: | blocker | Milestone: | 1.11 |
Component: | Loader | Version: | 1.7.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description (last modified by )
Ticket #12441 talks about adding in "use strict".
A few modules started including this (starting in 1.7?) __doPostBack
for ASP.NET throws this error if "use strict" is set:
''"TypeError: access to strict mode caller function is censored"''
(function() { "use strict"; __doPostBack('', ''); })();
Change History (15)
comment:1 Changed 9 years ago by
Description: | modified (diff) |
---|---|
Summary: | "use strict" issue with FireFox and ASP.NET → [regression] "use strict" issue with FireFox and ASP.NET |
comment:2 Changed 9 years ago by
It is part of the ASP.NET ajax script.
Paste of the offending function taken from MicrosoftAjaxWebForms?.js: http://pastebin.com/6kL2Vz2T
comment:3 Changed 9 years ago by
OK.
Are you saying that something about "use strict" in dojo modules affects the behavior of the client __doPostBack()
method which causes the server to throw an error?
Even though the "use strict" directives are in dojo code, but the dojo code itself doesn't call __doPostBack()
?
Can you attach a test case?
comment:4 Changed 9 years ago by
Anything wrapped in the dojo loader:
require([], function() { __doPostBack('', ''); });
comment:5 Changed 9 years ago by
OK, you'll need to attach a test case using the attach file button, hopefully something that runs without us needing to setup an ASP.NET server.
comment:6 Changed 9 years ago by
Milestone: | → tbd |
---|
comment:7 Changed 9 years ago by
Owner: | set to Kris Zyp |
---|
As Colin points out, the issue is that that __doPostBack()
function traces up the stack:
while (d.arguments.callee.caller && --j) d = d.arguments.callee.caller;
which is not compatible w/strict mode files.
I think Kris is the one that added those "use strict" directives so assigning to him, although not sure if we want to fix this on dojo's end or not.
comment:8 Changed 9 years ago by
It seems like if ASP.NET won't work with one of the central new features of ES5, that that is significant issue that ASP.NET needs to address, not us. What is the purpose of doPostBack? Does it do stack traces? Doesn't FF already have good stack traces?
That being said, we certainly could remove them, it certainly shouldn't break anything.
As another possibility, maybe we could optionally strip "use strict" when in sync mode (don't think we could do it in async mode), which would at least give better back-compat?
comment:9 Changed 9 years ago by
I just want to point out that inherited
and a few other functions in declare.js
also try to access a callee
property of an Arguments object:
http://bugs.dojotoolkit.org/browser/dojo/dojo/trunk/_base/declare.js#L100
Strict mode causes this to break as well, of course. Point being, it's not safe to assume foreign code will work properly in strict mode.
comment:11 Changed 9 years ago by
Diff here to remove "use strict"
https://github.com/skeeterbug84/dojo/commit/97b4dde216e31f2e010a21da5de9db56dd4d539e
comment:13 Changed 9 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I get the impression that the code path that was altered in that commit will only apply to the legacy loader? Also, I hope nobody ever writes "use strict"
anywhere in actual module code anywhere because I imagine this would end up stripping that just as well...
(To be clear, I'm not sure there'd be any way to perform this stripping in async or cross-domain modes. Seems to me the only clear winner if we want to eliminate barriers to adoption is to eliminate our usage of "use strict"
.)
comment:14 Changed 9 years ago by
I had thought this ticket was dealing with regression. I specified in the Dojo config documentation (http://livedocs.dojotoolkit.org/loader/amd#configuration-variables) that this setting only applies to legacy loading.
comment:15 Changed 5 years ago by
Component: | General → Loader |
---|---|
Milestone: | tbd → 1.11 |
Resolution: | → fixed |
Status: | reopened → closed |
I think this was solved a while ago, if not, please re-open.
Hmm, that's strange. Most of us don't have ASP.NET, and I don't know what _doPostBack() is or where this error is coming from. Are you saying that something about "use strict" in dojo modules affects the behavior of the client
__doPostBack()
method which causes the server to throw an error? Even though the "use strict" directives are in dojo code, but the dojo code itself doesn't call__doPostBack()
? Can you attach a test case?