     jslib_jail_doc.documentElement.appendChild(script_tag)
 
     root = jslib_jail_iframe.contentWindow.FactlinkJailRoot
+    $ = jslib_jail_iframe.contentWindow.$
     root.perf.add_existing_timing_event 'factlink_loader_start', factlink_loader_start_timestamp
     root.perf.add_existing_timing_event 'before_jail', load_time_before_jail
     root.perf.add_timing_event 'after_jail'
 
-    root.core_loaded_promise.done ->
+
+    root.core_loaded_promise
+    .then( -> root.ready_promise)
+    .then ->
       #called from jail-iframe when core iframe is ready.
       for name in methods
         do (name) ->

    # Wrapper for increased CSS specificity
    outerWrapperEl = mkEl 'div', 'factlink-containment-wrapper', jslib_jail_iframe

    document.body.appendChild outerWrapperEl

    load_time_before_jail = new Date().getTime()


        window.FACTLINK[methodCall.name](methodCall.arguments...)
      storedMethodCalls = undefined


  tryToInit = (i) -> ->
    if document.body
      whenHasBody()
    else
      console.log 'waiting #{i}...'
      setTimeout i, tryToInit(i+1)

  tryToInit(1)()

jslib_jail_code = __INLINE_JS_PLACEHOLDER__
style_code = __INLINE_CSS_PLACEHOLDER__
