Opened on 03/17/2016 at 01:40:34 PM
Closed on 03/17/2016 at 04:09:34 PM
Last modified on 05/25/2016 at 01:46:47 PM
#3822 closed defect (fixed)
jsHydra breaks strict-mode
Reported by: | sebastian | Assignee: | sebastian |
---|---|---|---|
Priority: | P3 | Milestone: | Adblock-Plus-1.12-for-Chrome-Opera-Safari |
Module: | Automation | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Platform: | Unknown / Cross platform | |
Ready: | yes | Confidential: | no |
Tester: | Ross | Verified working: | yes |
Review URL(s): |
Description
Observed behaviour
jsHydra, when using --arg module=true, wraps the code into a Common JS module. Therefore it has to initialize the exports variable before inserting the original code. However, in order to enable strict mode "use strict" must be the first token in the function. Currently, a module generated from a file using strict mode looks like that:
require.scopes["module"] = (function() { var exports = {}; "use strict"; ... return exports; })();
But as "use strict" isn't the first token, strict mode won't actually be enabled.
Expected behaviour
jsHydra should insert var exports = {}; after "use strict" if given at the beginning of the source file, in order to preserve strict-mode.
Attachments (0)
Change History (6)
comment:1 Changed on 03/17/2016 at 01:43:05 PM by sebastian
- Review URL(s) modified (diff)
- Status changed from new to reviewing
comment:2 Changed on 03/17/2016 at 03:42:24 PM by abpbot
comment:3 Changed on 03/17/2016 at 04:02:38 PM by abpbot
A commit referencing this issue has landed:
https://hg.adblockplus.org/buildtools/rev/cf407fe581d0
comment:4 Changed on 03/17/2016 at 04:08:36 PM by abpbot
A commit referencing this issue has landed:
https://hg.adblockplus.org/adblockpluschrome/rev/b1638c2d8f12
comment:5 Changed on 03/17/2016 at 04:09:34 PM by sebastian
- Milestone set to Adblock-Plus-for-Chrome-Opera-Safari-next
- Resolution set to fixed
- Status changed from reviewing to closed
comment:6 Changed on 05/25/2016 at 01:46:47 PM by Ross
- Tester changed from Unknown to Ross
- Verified working set
Checked this via confirming the .js files in the build have "use strict" at the top of the files (under the comment header).
ABP 1.11.0.1606
A commit referencing this issue has landed:
https://hg.adblockplus.org/jshydra/rev/91d258341fa8