Closed
Bug 945974
Opened 11 years ago
Closed 11 years ago
KumaScript variables are sometimes empty when they shouldn't be
Categories
(developer.mozilla.org Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: sheppy, Unassigned)
Details
(Whiteboard: [specification][type:bug])
What did you do? ================ 1. Run a macro 2. Get an error about a function not existing on "undefined" What happened? ============== Several macros appear to be reporting errors like this. See pages like: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/i https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em And more. What should have happened? ========================== The HTMLRef macro was unchanged when this started happening. I added some extra error checking code, but this is happening with other macros too. For instance, just now I just randomly picked the JavaScript Number page and shift-refreshed it, and now it doesn't work anymore: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number Is there anything else we should know? ====================================== This is EXTREMELY URGENT and must be fixed ASAP.
Comment 1•11 years ago
|
||
CC'ing :groovecoder and :lorchard, they may be able to help. I'm also bumping this up to critical severity.
Severity: normal → critical
Comment 2•11 years ago
|
||
I believe the issue is with a module [1] I edited earlier to cache the Stack Overflow data, and not with the kumascript service itself. Checking into it. [1]: https://developer.mozilla.org/en-US/docs/Template:mdn:common FWIW, when you see something like this, please include the *full* error in the bug. This is what I was able to reproduce: There are scripting messages on this page: TemplateExecutionError at document offset 4765 in macro HTMLRef ([]) ( edit ): Problem executing template HTMLRef: 100 | </table> 101 | </div> 102 | <p>{{HTMLRef}}</p> -----------^ TypeError: ejs:1 >> 1| <% 2| function containsTag(tagList, tag) { 3| if (tagList == null || tagList == undefined) return 0; 4| if (tag == undefined || tag == null) return 0; Cannot call method 'get' of undefined at /data/www/developer.mozilla.org/kuma/kumascript/lib/kumascript/api.js:258:12 at Object.fetchHTTPResource (eval at <anonymous> (/data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:203:1)) at Object.fetchJSONResource (eval at <anonymous> (/data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:203:1)) at [object Object].<anonymous> (eval at <anonymous> (/data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:203:1)) at eval at <anonymous> (/data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:203:1) at /data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:201:15 at /data/www/developer.mozilla.org/kuma/kumascript/lib/kumascript/templates.js:75:30
Comment 3•11 years ago
|
||
I think this is fixed now, with this module change: https://developer.mozilla.org/en-US/docs/Template:mdn:common$compare?to=500321&from=500143
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Just ran into this again for https://developer.mozilla.org/en-US/docs/Web/API/document.querySelector. There are scripting messages on this page: TemplateExecutionError at document offset 7 in macro DomRef ([]) ( edit ): Problem executing template DomRef: 1 | <div> 2 | {{DomRef()}}</div> ---------^ 3 | <h2 id="Summary" name="Summary">Summary</h2> 4 | <p>Returns the first element within the document (using depth-first pre-order traversal of the document's nodes) that matches the specified group of selectors.</p> TypeError: ejs:50 48| 49| %><%- result %></span> >> 50| <% 51| function containsTag(tagList, tag) { 52| if (!tagList || tagList == undefined) return 0; 53| tag = tag.toLowerCase(); Cannot call method 'toLowerCase' of undefined at containsAPI (eval at <anonymous> (/data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:203:1)) at eval at <anonymous> (/data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:203:1) at /data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:201:15 at /data/www/developer.mozilla.org/kuma/kumascript/lib/kumascript/templates.js:75:30
Comment 5•11 years ago
|
||
I'm digging into this now, so reopening as blocker (to test the bug paging process we set up in https://bugzilla.mozilla.org/show_bug.cgi?id=886497)
Severity: critical → blocker
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 6•11 years ago
|
||
The error in DomRef was not the same as this bug. Fixed with this change to the macro: https://developer.mozilla.org/en-US/docs/Template:DomRef$compare?to=500489&from=488647 Sometimes, variables are empty when they should be, and this code was not properly detecting it.
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
Resolution: --- → FIXED
Comment 7•11 years ago
|
||
How do I force a page to pick up that DomRef change? Still seeing an error on https://developer.mozilla.org/en-US/docs/Web/API/navigator.doNotTrack
Reporter | ||
Comment 8•11 years ago
|
||
(In reply to Janet Swisher from comment #7) > How do I force a page to pick up that DomRef change? Still seeing an error > on https://developer.mozilla.org/en-US/docs/Web/API/navigator.doNotTrack Shift-reload the page. That should do it.
Comment 9•11 years ago
|
||
It finally loaded OK, but it took about 3 shift-reloads. Definitely did not work on the first try. Our users are going to keep seeing these errors for a while.
Comment 10•11 years ago
|
||
(In reply to Janet Swisher from comment #9) > It finally loaded OK, but it took about 3 shift-reloads. Definitely did not > work on the first try. Our users are going to keep seeing these errors for a > while. When you say "it took about 3 shift-reloads" - what exactly happpened? That is when you hit shift-reload, what did you see that led you to believe you needed to shift-reload again each time? Exactly what didn't work might be something I need to investigate. It might be that the page just took a long time to build, and that the first shift-reload hadn't completed before you started the second two. Or, it might be something else.
Comment 11•11 years ago
|
||
I see this in https://developer.mozilla.org/en-US/docs/Web/API/Window.setInterval and https://developer.mozilla.org/en-US/docs/Web/API/Window.setTimeout as of this writing (after a couple of Shift+R in Google Chrome: ======== https://developer.mozilla.org/en-US/docs/Web/API/Window.setTimeout There are scripting messages on this page: TemplateExecutionError at document offset 7 in macro DomRef ([]) ( edit ): Problem executing template DomRef: 1 | <div> 2 | {{ DomRef() }}</div> ---------^ 3 | <h2 id="Summary" name="Summary">Summary</h2> 4 | <p>Calls a function or executes a code snippet after a specified delay.</p> TypeError: ejs:50 48| 49| %><%- result %></span> >> 50| <% 51| function containsTag(tagList, tag) { 52| if (!tagList || typeof tagList == 'undefined') return 0; 53| tag = tag.toLowerCase(); Cannot call method 'toLowerCase' of undefined at containsAPI (eval at <anonymous> (/data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:203:1)) at eval at <anonymous> (/data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:203:1) at /data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:201:15 at /data/www/developer.mozilla.org/kuma/kumascript/lib/kumascript/templates.js:75:30 ======== https://developer.mozilla.org/en-US/docs/Web/API/Window.setInterval There are scripting messages on this page: TemplateExecutionError at document offset 8 in macro DomRef ([]) ( edit ): Problem executing template DomRef: 1 | <div> 2 | {{DomRef}}</div> ----------^ 3 | <h2 id="Summary" name="Summary">Summary</h2> 4 | <p>Calls a function or executes a code snippet repeatedly, with a fixed time delay between each call to that function.</p> TypeError: ejs:50 48| 49| %><%- result %></span> >> 50| <% 51| function containsTag(tagList, tag) { 52| if (!tagList || typeof tagList == 'undefined') return 0; 53| tag = tag.toLowerCase(); Cannot call method 'toLowerCase' of undefined at containsAPI (eval at <anonymous> (/data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:203:1)) at eval at <anonymous> (/data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:203:1) at /data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:201:15 at /data/www/developer.mozilla.org/kuma/kumascript/lib/kumascript/templates.js:75:30
Comment 12•11 years ago
|
||
Hmmh, https://developer.mozilla.org/en-US/docs/Web/API/Window.setInterval renders without error now. But https://developer.mozilla.org/en-US/docs/Web/API/Window.setTimeout still shows these: There are scripting messages on this page: TemplateExecutionError at document offset 7 in macro DomRef ([]) ( edit ): Problem executing template DomRef: 1 | <div> 2 | {{ DomRef() }}</div> ---------^ 3 | <h2 id="Summary" name="Summary">Summary</h2> 4 | <p>Calls a function or executes a code snippet after a specified delay.</p> TypeError: ejs:50 48| 49| %><%- result %></span> >> 50| <% 51| function containsTag(tagList, tag) { 52| if (!tagList || typeof tagList == 'undefined') return 0; 53| tag = tag.toLowerCase(); Cannot call method 'toLowerCase' of undefined at containsAPI (eval at <anonymous> (/data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:203:1)) at eval at <anonymous> (/data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:203:1) at /data/www/developer.mozilla.org/kuma/kumascript/node_modules/ejs/lib/ejs.js:201:15 at /data/www/developer.mozilla.org/kuma/kumascript/lib/kumascript/templates.js:75:30
Comment 13•11 years ago
|
||
I am able to reproduce the problem in comment #12 in Firefox Nightly 28.0a1 (2013-12-08) as well!
Comment 14•11 years ago
|
||
I did a shift-reload on the second and the problem went away. It is likely a cache problem now. (The first link was ok)
Comment 15•11 years ago
|
||
Now both pages render fine for me in chrome and firefox. But I did many Shift+R, even Ctrl+Shift+R and the problems persisted. Is there server-side caching involved as well?
Comment 16•11 years ago
|
||
Both pages were still reporting an error to me. Not sure why this might be intermittent, but it looks similar to comment 6. The DomRef template wasn't checking if there was a tag before attempting to call tag.toLowerCase(). Not familiar with the code, so I'm sure why that parameter would be undefined. But, this change seems to have fixed the error: https://developer.mozilla.org/en-US/docs/Template:DomRef$compare?to=505611&from=500489
Updated•4 years ago
|
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•