Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(515)

Issue 4439090: Enable proper common container globals initialization when dynamically loading

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 11 months ago by Stanton
Modified:
12 years, 11 months ago
CC:
dev_shindig.apache.org
Base URL:
http://svn.apache.org/repos/asf/shindig/trunk/features
Visibility:
Public.

Description

JIRA: https://issues.apache.org/jira/browse/SHINDIG-1533 This is a fix/workaround for an issue I've encountered in init.js#initializeGlobalVars() when dynamically loading the container.js. The code as it exists today assumes that the <script> tag loading the container.js will be the last one encountered for the document. This is not always the case, especially when loading the container.js by dynamically inserting the <script> tag in the page. If the wrong script tag is used, the __API_URI and __CONTAINER_URI globals will not initialize properly. My fix is to introduce another window global that can be set before dynamically loading the container.js. This new global will unambiguously specify the proper script tag by providing the ID. I'm also interested to hear of other solutions. Until coming up with this solution I had just been overriding the improperly init'd globals before doing anything with the Common Container. This seems fragile as more globals could be added in the future or used at unexpected times.

Patch Set 1 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -3 lines) Patch
src/main/javascript/features/container/init.js View 1 chunk +12 lines, -3 lines 0 comments Download

Messages

Total messages: 7
Stanton
12 years, 11 months ago (2011-05-03 20:58:44 UTC) #1
Stanton
I don't think putting it in the container config is viable. The reason being that ...
12 years, 11 months ago (2011-05-04 12:05:32 UTC) #2
rbaxter85
So when does initializeGlobalVars() get called? Does it called when you construct the osapi.container.Container object ...
12 years, 11 months ago (2011-05-04 13:18:21 UTC) #3
Stanton
initializeGlobalVars gets called when we load init.js. init.js is loaded after all of the other ...
12 years, 11 months ago (2011-05-04 14:12:07 UTC) #4
Stanton
Adding the common container specification authors as reviewers to get their thoughts.
12 years, 11 months ago (2011-05-04 14:28:04 UTC) #5
mhermanto
On 2011/05/04 14:28:04, Stanton wrote: > Adding the common container specification authors as reviewers to ...
12 years, 11 months ago (2011-05-04 17:18:50 UTC) #6
mhermanto
12 years, 11 months ago (2011-05-16 20:24:31 UTC) #7
LGTM
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b