   # Route message as if it was sent internally.
   onMessage message, sender, sendResponse
 
+# Avoid repetitive calls to render the text contents of a Mustache section by passed `callback` the
+# pre-rendered text and safely handling bad returns.
+rendered = (callback) ->
+  -> (text, render) -> callback(render text) ? ''
+
 # Attempt to select a tab in the current window displaying a page whose location begins with
 # `url`.  
 # If no existing tab exists a new one is created.

    selectmarkdown:        ->
      getCallback 'selectmarkdown'
    # Deprecated since 1.0.0, use `shorten` instead.
    short:                 ->
      do @shorten
    shortcuts:             shortcuts.enabled
    shortcutspaste:        shortcuts.paste
    shorten:               ->
      getCallback 'shorten'
    tidy:                  ->
      (text, render) ->
        render(text).replace(/([ \t]+)/g, ' ').trim()
    title:                 ctab.title or url.attr 'source'
    toolbarclose:          toolbar.close
    # Deprecated since 1.0.0, use the inverse of `toolbarpopup` instead.
    toolbarfeature:        ->
      not @toolbarpopup
    # Deprecated since 1.0.0, use `toolbarstyle` instead.
    toolbarfeaturedetails: ->
      @toolbarstyle
    # Deprecated since 1.0.0, use `toolbarkey` instead.
    toolbarfeaturename:    ->
      @toolbarkey
    toolbarkey:            toolbar.key
    toolbaroptions:        toolbar.options
    toolbarpopup:          toolbar.popup
    # Obsolete since 1.1.0, functionality has been removed.
    toolbarstyle:          no
    trim:                  ->
      (text, render) ->
        render(text).trim()
    trimleft:              ->
      (text, render) ->
        render(text).trimLeft()
    trimright:             ->
      (text, render) ->
        render(text).trimRight()
    unescape:              ->
      (text, render) ->
        _.unescape render text
    uppercase:             ->
      (text, render) ->
        render(text).toUpperCase()
    url:                   url.attr 'source'
    version:               ext.version
    xpath:                ->
      getCallback 'xpath'
    xpathall:             ->

    notificationduration:  notifications.duration * .001
    offline:               not navigator.onLine
    # Deprecated since 0.1.0.2, use `originalurl` instead.
    originalsource:        -> @originalurl
    originaltitle:         tab.title or url.attr 'source'
    originalurl:           tab.url
    os:                    operatingSystem
    param:                 rendered (text) ->
      url.param text
    params:                nullIfEmpty url.param()
    plugins:               _.chain(navigator.plugins).pluck('name').uniq().value()
    popular:               $.extend yes, {}, _.findWhere ext.templates, key: stats.popular
    screenheight:          screen.height
    screenwidth:           screen.width
    segment:               rendered (text) ->
      url.segment parseInt text, 10
    segments:              url.segment()
    select:                ->
      getCallback 'select'
