Bug 61473 - REGRESSION (r67163): twitter.com doesn't load properly the first time
Summary: REGRESSION (r67163): twitter.com doesn't load properly the first time
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P1 Critical
Assignee: Nobody
URL: http://twitter.com
Keywords: InRadar, NeedsReduction, Regression
Depends on: 45310
  Show dependency treegraph
Reported: 2011-05-25 15:06 PDT by Andy Estes
Modified: 2012-06-21 15:24 PDT (History)
5 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Andy Estes 2011-05-25 15:06:55 PDT
In some cases, twitter.com fails to load the timeline with a cold cache. The black toolbar loads, but a JavaScript error prevents the rest of the page from loading. The error is typically something like:

TypeError: 'undefined' is not an object (evaluating 'twttr.anywhere.api')

See the attached screenshot to see what the page looks like when this happens.

The problem seems to be specific to a subset of twitter accounts and usually goes away if you reload the page. Since I am able to see this error, I'll work on a reduction.
Comment 1 Andy Estes 2011-05-25 15:07:15 PDT
Comment 2 Andy Estes 2011-05-25 15:08:51 PDT
This is a regression due to <http://trac.webkit.org/changeset/67163>
Comment 3 Andy Estes 2011-05-25 15:22:35 PDT
There is a JavaScript function in the main document called initAPI() that calls twttr.anywhere.api.initialize().

twttr.anywhere.api is defined in an external resource that is included earlier in the main document using:
<script type="text/javascript" async="" src="https://si1.twimg.com/a/1306171173/javascripts/api.bundle.js"></script>

Since the script tag has the async attribute, it can load after initAPI() executes. Sounds like a race condition.
Comment 4 Adam Barth 2011-05-25 15:26:03 PDT
Sounds like we should evangelize them to not use async and rely on script ordering!
Comment 5 Theresa O'Connor 2011-05-25 16:46:54 PDT
I've evang'ed; they already knew about this, and have a fix on the way.
Comment 6 Andy Estes 2011-05-25 17:05:29 PDT
(In reply to comment #5)
> I've evang'ed; they already knew about this, and have a fix on the way.

That's great! Do you have any sense of timeframe so we know when to verify the fix?
Comment 7 Theresa O'Connor 2011-05-25 20:19:37 PDT
I'll ask.
Comment 8 Elliott Sprehn 2012-06-21 15:24:14 PDT
They don't even include the referenced script anymore and it appears they're using async more carefully.