| Summary: | Web Inspector: Exception under ObjectTreeView.js on specific code.tutsplus.com page | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Timothy Hatcher <timothy> |
| Component: | Web Inspector | Assignee: | Joseph Pecoraro <joepeck> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | ggaren, graouts, joepeck, jonowells, mattbaker, nvasilyev, timothy, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | 528+ (Nightly build) | ||
| Hardware: | All | ||
| OS: | All | ||
| URL: | http://code.tutsplus.com/tutorials/say-hello-to-webkit-filters--net-23318 | ||
|
Description
Timothy Hatcher
2015-04-27 19:51:03 PDT
I don't understand how this is possible.
Here is the code, annotated with some comments.
...
// By this point, a and b should be strings. If they aren't something else went wrong in surrounding code.
// 1. Rule out equivalent names.
if (a === b)
return 0;
while (diff === 0) {
// 2. Rule out one being shorter then the other.
if (!a && b)
return -1;
if (!b && a)
return 1;
chunka = a.match(chunk)[0];
chunkb = b.match(chunk)[0];
anum = !isNaN(chunka);
bnum = !isNaN(chunkb);
// 3. Number versus non number cases.
if (anum && !bnum)
return -1;
if (bnum && !anum)
return 1;
// 4. Number differences, if the same we continue.
if (anum && bnum) {
diff = chunka - chunkb;
if (diff === 0 && chunka.length !== chunkb.length) {
if (!+chunka && !+chunkb) // chunks are strings of all 0s (special case)
return chunka.length - chunkb.length;
else
return chunkb.length - chunka.length;
}
}
// 5. Different strings
else if (chunka !== chunkb)
return (chunka < chunkb) ? -1 : 1;
// 6. Proceed to the next part of the string.
a = a.substring(chunka.length);
b = b.substring(chunkb.length);
}
...
For us to have encountered a.match(chunk) and have "a" be null then, I think something must have gone wrong.
I believe Geoff just re-wrote Array.prototype.sort, so maybe that is related?
Tim, it looks like Geoff's sort changes (r183288) got rolled out a bit later (r183308). My ToT (r183442) was not encountering the issue. Do you know what r### your JavaScriptCore was? I had Geoff's change at the time. Rebuilding to see if it is better. Looks fine now. I see this in TOT, and in 183568, just before the Array.prototype.sort patch re-landed: Uncaught exception in inspector page while handling event Network.responseReceived: (2) TypeError: undefined is not an object (evaluating 'b.resource.type') "compareResourceTreeElements@Main.js:6957:63 compareFolderAndResourceTreeElements@Main.js:6968:114 value@Main.js:516:107 insertionIndexForObjectInListSortedByFunction@Main.js:535:96 descendantResourceTreeElementTypeDidChange@Main.js:6825:240 callFirstAncestorFunction@Main.js:6238:130 _typeDidChange@Main.js:6992:112 dispatch@Main.js:100:158 dispatchEventToListeners@Main.js:102:9 updateForResponse@Main.js:3576:30 resourceRequestDidReceiveResponse@Main.js:14444:51 responseReceived@Main.js:797:69 dispatchEvent@Main.js:723:34 _dispatchEvent@Main.js:687:55 dispatch@Main.js:651:20 dispatchNextQueuedMessageFromBackend@Main.js:786:32" _dispatchEventMain.js:687:105 dispatchMain.js:651 dispatchNextQueuedMessageFromBackend Geoff, was that loading the same page linked above? (In reply to comment #7) > Geoff, was that loading the same page linked above? Yeah, same page. Seems to be fine.(In reply to comment #8) > (In reply to comment #7) > > Geoff, was that loading the same page linked above? > > Yeah, same page. Filed new bug about that. Bug 147451. |