Change from Porthole to EasyXDM #129

Merged
merged 11 commits into from Jun 19, 2012

Conversation

Projects
None yet
2 participants
Contributor

Jakobo commented Jun 15, 2012

What we're getting with this switch.

  1. easyXDM is a bit more tested and therefore reliable (Latest MS changes break Porthole in weird incompatible ways)
  2. Setup is easier. Place both relay.html and relay.html on your alternate domain. This means relay.html doesn't have to have the weird dual-mode issue anymore
  3. Refactored API. To simplify setup, all the API changes from #127 have been folded in. This internalizes many of Inject's proprietary things (to the Inject.INTERNAL namespace) leaving Inject.* free for configuring inject. This also frees up require, leaving it to supply only the compliant APIs for CommonJS and AMD.

What we're giving up.

  1. a 12k increase in payload. This makes the library begin to feel very heavy. This will increase the need for us to solve "plugins" per #90 to keep things fast. We should also consider modifying the default build to produce a inject.lite.js/inject.lite.min.js which doesn't have the cross domain weight. old: 30,883 bytes (33 KB on disk) & new: 42,403 bytes (45 KB on disk)
  2. Simplicity in the Cross Domain interaction. easyXDM is hard that said, it's really well supported, and LinkedIn is already using it on the developer.linkedin.com properties without much issue. The code is easy to follow and the API has been incredibly stable for some time. Right now, we're using the simple socket method although we could also do RPC if we want to do that refactor at a later time.

Overall, I think this is a healthy change for the framework. Random IE breakages are not something we really want to be dealing with; that makes picking the juggernaut library a bit more of a rational choice.

The Major API Changes

  • require.setModuleRoot becomes Inject.setModuleRoot (no param change)
  • require.setCrossDomain becomes Inject.setCrossDomain and has the following param changes
    • Instead of two strings (local/remote) which was confusing, this now takes an object with relayFile and relayHelper as keys. They map to relay.html and relay_helper.html respectively. both these files go on the remote hosting location
  • The remainder of the API shifts can be found in #127

@Jakobo Jakobo commented on an outdated diff Jun 15, 2012

src/inject.coffee
-if lscacheSchemaVersion && lscacheSchemaVersion > 0 && lscacheSchemaVersion < schemaVersion
- lscache.flush()
- lscacheSchemaVersion = 0
-if !lscacheSchemaVersion then lscache.set(schemaVersionString, schemaVersion)
+ if lscacheSchemaVersion && lscacheSchemaVersion > 0 && lscacheSchemaVersion < schemaVersion
+ lscache.flush()
+ lscacheSchemaVersion = 0
+ if !lscacheSchemaVersion then lscache.set(schemaVersionString, schemaVersion)
+
+###
+easyxdm configuration
+###
+easyXDM = if context.easyXDM then context.easyXDM.noConflict() else false
@Jakobo

Jakobo Jun 15, 2012

Contributor

looking back at this line, this seems dangerous. We should flag that we're using our easyXDM ...

Contributor

fsimeon commented Jun 15, 2012

Was this what was causing the issues in ie 7?

Looks good
ship it.

Contributor

Jakobo commented Jun 15, 2012

It was certainly contributing. Porthole had major IE7 issues thanks to
updates from MS regarding the parent.parent frame chaining. The SWF
solution from easyXDM is a universal solution. It's slow in IE7, but works
which is key. Using AMD and the localStorage Shim become really important
to keep IE7 in the game perf wise.

--Jakob

On Fri, Jun 15, 2012 at 3:15 PM, Fermin Simeon <
reply@reply.github.com

wrote:

Was this what was causing the issues in ie 7?

Looks good
ship it.


Reply to this email directly or view it on GitHub:
#129 (comment)

Jakobo was assigned Jun 18, 2012

@Jakobo Jakobo added a commit that referenced this pull request Jun 19, 2012

@Jakobo Jakobo Merge pull request #129 from Jakobo/easyxdm_port
Change from Porthole to EasyXDM
08d35e1

@Jakobo Jakobo merged commit 08d35e1 into linkedin:master Jun 19, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment