com.google.gwt.core.linker

## Class CrossSiteIframeLinker

- java.lang.Object
- - com.google.gwt.core.ext.Linker
  - - com.google.gwt.core.ext.linker.AbstractLinker
    - - com.google.gwt.core.ext.linker.impl.SelectionScriptLinker
      - - com.google.gwt.core.linker.CrossSiteIframeLinker

- Direct Known Subclasses:
    DirectInstallLinker

      @LinkerOrder(value=PRIMARY)
      @Shardable
      public class CrossSiteIframeLinker
      extends com.google.gwt.core.ext.linker.impl.SelectionScriptLinker

  This linker uses an iframe to hold the code and a script tag to download the code. It can download code cross-site, because it uses a script tag to download it and because it never uses XHR. The iframe, meanwhile, makes it trivial to install additional code as the app runs.

- - ### Field Summary

    - ### Fields inherited from class com.google.gwt.core.ext.linker.impl.SelectionScriptLinker

      `COMPUTE_SCRIPT_BASE_JS, FRAGMENT_EXTENSION, FRAGMENT_SUBDIR, permutationsUtil, PROCESS_METAS_JS, USE_SOURCE_MAPS_PROPERTY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CrossSiteIframeLinker()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.lang.String` | `fillSelectionScriptTemplate(java.lang.StringBuffer ss, TreeLogger logger, LinkerContext context, ArtifactSet artifacts, CompilationResult result)` Generate a selection script.
    `protected boolean` | `getBooleanConfigurationProperty(LinkerContext context, java.lang.String name, boolean def)`
    `protected java.lang.String` | `getCompilationExtension(TreeLogger logger, LinkerContext context)`
    `protected java.lang.String` | `getDeferredFragmentSuffix(TreeLogger logger, LinkerContext context, int fragment)`
    `java.lang.String` | `getDescription()` Returns a human-readable String describing the Linker.
    `protected java.lang.String` | `getHostedFilename()`
    `protected java.lang.String` | `getHostedFilenameFull(LinkerContext context)`
    `protected java.lang.String` | `getJsComputeScriptBase(LinkerContext context)` Returns the name of the `ComputeScriptBase` script.
    `protected java.lang.String` | `getJsComputeUrlForResource(LinkerContext context)` Returns the name of the `UrlForResource` script.
    `protected java.lang.String` | `getJsDevModeRedirectHook(LinkerContext context)` Returns a code fragment to check for the new development mode.
    `protected java.lang.String` | `getJsInstallLocation(LinkerContext context)` Returns the name of the `JsInstallLocation` script.
    `protected java.lang.String` | `getJsInstallScript(LinkerContext context)` Returns the name of the `JsInstallScript` script.
    `protected java.lang.String` | `getJsIsBodyLoaded(LinkerContext context)` Returns the name of the `JsIsBodyLoaded` script.
    `protected java.lang.String` | `getJsLoadExternalStylesheets(LinkerContext context)` Returns the name of the `JsLoadExternalStylesheets` script.
    `protected java.lang.String` | `getJsModuleFunctionErrorCatch(LinkerContext context)` Returns the name of the `JsModuleFunctionErrorCatch` script.
    `protected java.lang.String` | `getJsPermutations(LinkerContext context)` Returns the name of the `JsPermutations` script.
    `protected java.lang.String` | `getJsProcessMetas(LinkerContext context)` Returns the name of the `JsProcessMetas` script.
    `protected java.lang.String` | `getJsProperties(LinkerContext context)` Returns the name of the `JsProperties` script.
    `protected java.lang.String` | `getJsRunAsync(LinkerContext context)` Returns the name of the `JsRunAsync` script.
    `protected java.lang.String` | `getJsWaitForBodyLoaded(LinkerContext context)` Returns the name of the `JsWaitForBodyLoaded` script.
    `protected java.lang.String` | `getModulePrefix(TreeLogger logger, LinkerContext context, java.lang.String strongName)` Compute the beginning of a JavaScript file that will hold the main module implementation.
    `protected java.lang.String` | `getModuleSuffix(TreeLogger logger, LinkerContext context)`
    `protected java.lang.String` | `getScriptChunkSeparator(TreeLogger logger, LinkerContext context)` Some subclasses support "chunking" of the primary fragment.
    `protected java.lang.String` | `getSelectionScriptTemplate(TreeLogger logger, LinkerContext context)`
    `protected java.lang.String` | `getStringConfigurationProperty(LinkerContext context, java.lang.String name, java.lang.String def)`
    `protected void` | `includeJs(java.lang.StringBuffer selectionScript, TreeLogger logger, java.lang.String jsSource, java.lang.String templateVar)`
    `protected void` | `maybeAddHostedModeFile(TreeLogger logger, LinkerContext context, ArtifactSet artifacts, CompilationResult result)` Add the Development Mode file to the artifact set.
    `protected void` | `maybeOutputPropertyMap(TreeLogger logger, LinkerContext context, ArtifactSet toReturn)`
    `protected boolean` | `shouldIncludeBootstrapInPrimaryFragment(LinkerContext context)`
    `protected boolean` | `shouldInstallCode(LinkerContext context)`
    `protected boolean` | `shouldUseSelfForWindowAndDocument(LinkerContext context)` Returns whether to use "self" for $wnd and $doc references.
    `protected java.lang.String` | `wrapDeferredFragment(TreeLogger logger, LinkerContext context, int fragment, java.lang.String js, ArtifactSet artifacts)`
    `protected java.lang.String` | `wrapPrimaryFragment(TreeLogger logger, LinkerContext context, java.lang.String script, ArtifactSet artifacts, CompilationResult result)`

    - ### Methods inherited from class com.google.gwt.core.ext.linker.impl.SelectionScriptLinker

      `charsPerChunk, doEmitCompilation, emitSelectionInformation, emitSelectionScript, generateDeferredFragment, generatePrimaryFragment, generatePrimaryFragmentString, generateSelectionScript, generateSelectionScript, getDeferredFragmentPrefix, getFragmentSubdir, getModulePrefix, link, link, readFileToStringBuffer, replaceAll, splitPrimaryJavaScript, supportsDevModeInJunit`

    - ### Methods inherited from class com.google.gwt.core.ext.linker.AbstractLinker

      `emitBytes, emitBytes, emitInputStream, emitInputStream, emitString, emitString, emitWithStrongName, emitWithStrongName`

    - ### Methods inherited from class com.google.gwt.core.ext.Linker

      `isShardable, relink`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CrossSiteIframeLinker

          public CrossSiteIframeLinker()

  - ### Method Detail

    - #### getDescription

          public java.lang.String getDescription()

      Description copied from class: `Linker`
      Returns a human-readable String describing the Linker.
      Specified by:
        `getDescription` in class `Linker`

    - #### fillSelectionScriptTemplate

          protected java.lang.String fillSelectionScriptTemplate(java.lang.StringBuffer ss,
                                                     TreeLogger logger,
                                                     LinkerContext context,
                                                     ArtifactSet artifacts,
                                                     CompilationResult result)
                                                          throws UnableToCompleteException

      Description copied from class: `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`
      Generate a selection script. The selection information should previously have been scanned using `PermutationsUtil.setupPermutationsMap(ArtifactSet)`.
      Overrides:
        `fillSelectionScriptTemplate` in class `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`
      Throws:
        `UnableToCompleteException`

    - #### getBooleanConfigurationProperty

          protected boolean getBooleanConfigurationProperty(LinkerContext context,
                                                java.lang.String name,
                                                boolean def)

    - #### getCompilationExtension

          protected java.lang.String getCompilationExtension(TreeLogger logger,
                                                 LinkerContext context)

      Specified by:
        `getCompilationExtension` in class `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`

    - #### getDeferredFragmentSuffix

          protected java.lang.String getDeferredFragmentSuffix(TreeLogger logger,
                                                   LinkerContext context,
                                                   int fragment)

      Overrides:
        `getDeferredFragmentSuffix` in class `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`

    - #### getHostedFilename

          protected java.lang.String getHostedFilename()

      Overrides:
        `getHostedFilename` in class `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`

    - #### getHostedFilenameFull

          protected java.lang.String getHostedFilenameFull(LinkerContext context)

    - #### getJsComputeScriptBase

          protected java.lang.String getJsComputeScriptBase(LinkerContext context)

      Returns the name of the `ComputeScriptBase` script. By default, returns `"com/google/gwt/core/ext/linker/impl/computeScriptBase.js"`.
      Parameters:
        `context` - a LinkerContext

    - #### getJsComputeUrlForResource

          protected java.lang.String getJsComputeUrlForResource(LinkerContext context)

      Returns the name of the `UrlForResource` script. By default, returns `"com/google/gwt/core/ext/linker/impl/computeUrlForResource.js"`.
      Parameters:
        `context` - a LinkerContext

    - #### getJsDevModeRedirectHook

          protected java.lang.String getJsDevModeRedirectHook(LinkerContext context)

      Returns a code fragment to check for the new development mode.

    - #### getJsInstallLocation

          protected java.lang.String getJsInstallLocation(LinkerContext context)

      Returns the name of the `JsInstallLocation` script. By default, returns `"com/google/gwt/core/ext/linker/impl/installLocationIframe.js"`.
      Parameters:
        `context` - a LinkerContext

    - #### getJsInstallScript

          protected java.lang.String getJsInstallScript(LinkerContext context)

      Returns the name of the `JsInstallScript` script. By default, returns `"com/google/gwt/core/ext/linker/impl/installScriptEarlyDownload.js"`.

      If you override this to return `installScriptDirect.js`, then you should also override `shouldInstallCode(LinkerContext)` to return `false`.

      Parameters:
        `context` - a LinkerContext

    - #### getJsIsBodyLoaded

          protected java.lang.String getJsIsBodyLoaded(LinkerContext context)

      Returns the name of the `JsIsBodyLoaded` script. By default, returns `"com/google/gwt/core/ext/linker/impl/isBodyLoaded.js"`.
      Parameters:
        `context` - a LinkerContext

    - #### getJsLoadExternalStylesheets

          protected java.lang.String getJsLoadExternalStylesheets(LinkerContext context)

      Returns the name of the `JsLoadExternalStylesheets` script. By default, returns `"com/google/gwt/core/ext/linker/impl/loadExternalStylesheets.js"`.
      Parameters:
        `context` - a LinkerContext

    - #### getJsModuleFunctionErrorCatch

          protected java.lang.String getJsModuleFunctionErrorCatch(LinkerContext context)

      Returns the name of the `JsModuleFunctionErrorCatch` script. By default returns null. This script executes if there's an error loading the module function or executing it. The error will be available under a local variable named "moduleError". If non-null, the module function and the call to the module function will be placed in a try/catch block.
      Parameters:
        `context` - a LinkerContext

    - #### getJsPermutations

          protected java.lang.String getJsPermutations(LinkerContext context)

      Returns the name of the `JsPermutations` script. By default, returns `"com/google/gwt/core/ext/linker/impl/permutations.js"`.
      Parameters:
        `context` - a LinkerContext

    - #### getJsProcessMetas

          protected java.lang.String getJsProcessMetas(LinkerContext context)

      Returns the name of the `JsProcessMetas` script. By default, returns `"com/google/gwt/core/ext/linker/impl/processMetas.js"`.
      Parameters:
        `context` - a LinkerContext

    - #### getJsProperties

          protected java.lang.String getJsProperties(LinkerContext context)

      Returns the name of the `JsProperties` script. By default, returns `"com/google/gwt/core/ext/linker/impl/properties.js"`.
      Parameters:
        `context` - a LinkerContext

    - #### getJsRunAsync

          protected java.lang.String getJsRunAsync(LinkerContext context)

      Returns the name of the `JsRunAsync` script. By default, returns `"com/google/gwt/core/ext/linker/impl/runAsync.js"`.
      Parameters:
        `context` - a LinkerContext

    - #### getJsWaitForBodyLoaded

          protected java.lang.String getJsWaitForBodyLoaded(LinkerContext context)

      Returns the name of the `JsWaitForBodyLoaded` script. By default, returns `"com/google/gwt/core/ext/linker/impl/waitForBodyLoaded.js"`.
      Parameters:
        `context` - a LinkerContext

    - #### getModulePrefix

          protected java.lang.String getModulePrefix(TreeLogger logger,
                                         LinkerContext context,
                                         java.lang.String strongName)
                                              throws UnableToCompleteException

      Description copied from class: `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`
      Compute the beginning of a JavaScript file that will hold the main module implementation.
      Specified by:
        `getModulePrefix` in class `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`
      Throws:
        `UnableToCompleteException`

    - #### getModuleSuffix

          protected java.lang.String getModuleSuffix(TreeLogger logger,
                                         LinkerContext context)

      Specified by:
        `getModuleSuffix` in class `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`

    - #### getScriptChunkSeparator

          protected java.lang.String getScriptChunkSeparator(TreeLogger logger,
                                                 LinkerContext context)

      Description copied from class: `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`
      Some subclasses support "chunking" of the primary fragment. If chunking will be supported, this function should be overridden to return the string which should be inserted between each chunk.
      Overrides:
        `getScriptChunkSeparator` in class `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`

    - #### getSelectionScriptTemplate

          protected java.lang.String getSelectionScriptTemplate(TreeLogger logger,
                                                    LinkerContext context)

      Specified by:
        `getSelectionScriptTemplate` in class `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`

    - #### getStringConfigurationProperty

          protected java.lang.String getStringConfigurationProperty(LinkerContext context,
                                                        java.lang.String name,
                                                        java.lang.String def)

    - #### includeJs

          protected void includeJs(java.lang.StringBuffer selectionScript,
                       TreeLogger logger,
                       java.lang.String jsSource,
                       java.lang.String templateVar)
                            throws UnableToCompleteException

      Throws:
        `UnableToCompleteException`

    - #### maybeAddHostedModeFile

          protected void maybeAddHostedModeFile(TreeLogger logger,
                                    LinkerContext context,
                                    ArtifactSet artifacts,
                                    CompilationResult result)
                                         throws UnableToCompleteException

      Description copied from class: `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`
      Add the Development Mode file to the artifact set.
      Overrides:
        `maybeAddHostedModeFile` in class `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`
      Throws:
        `UnableToCompleteException`

    - #### maybeOutputPropertyMap

          protected void maybeOutputPropertyMap(TreeLogger logger,
                                    LinkerContext context,
                                    ArtifactSet toReturn)

      Overrides:
        `maybeOutputPropertyMap` in class `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`

    - #### shouldIncludeBootstrapInPrimaryFragment

          protected boolean shouldIncludeBootstrapInPrimaryFragment(LinkerContext context)

    - #### shouldInstallCode

          protected boolean shouldInstallCode(LinkerContext context)

    - #### shouldUseSelfForWindowAndDocument

          protected boolean shouldUseSelfForWindowAndDocument(LinkerContext context)

      Returns whether to use "self" for $wnd and $doc references. Defaults to false. Useful for worker threads.

    - #### wrapDeferredFragment

          protected java.lang.String wrapDeferredFragment(TreeLogger logger,
                                              LinkerContext context,
                                              int fragment,
                                              java.lang.String js,
                                              ArtifactSet artifacts)

      Overrides:
        `wrapDeferredFragment` in class `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`

    - #### wrapPrimaryFragment

          protected java.lang.String wrapPrimaryFragment(TreeLogger logger,
                                             LinkerContext context,
                                             java.lang.String script,
                                             ArtifactSet artifacts,
                                             CompilationResult result)
                                                  throws UnableToCompleteException

      Overrides:
        `wrapPrimaryFragment` in class `com.google.gwt.core.ext.linker.impl.SelectionScriptLinker`
      Throws:
        `UnableToCompleteException`