You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2015/06/02 00:21:45 UTC

tapestry-5 git commit: TAP5-2339: Ajax exception frame complains about "Function expected" in IE8

Repository: tapestry-5
Updated Branches:
  refs/heads/master 1dbcb377e -> a949d55e7


TAP5-2339: Ajax exception frame complains about "Function expected" in IE8

Resolution involves not re-using the exception container; this seems like it can be a race condition in IE8


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a949d55e
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a949d55e
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a949d55e

Branch: refs/heads/master
Commit: a949d55e7b5dfbc590e5b0ad3e557ef1143922ae
Parents: 1dbcb37
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Jun 1 15:21:37 2015 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Jun 1 15:21:37 2015 -0700

----------------------------------------------------------------------
 .../modules/t5/core/exception-frame.coffee      | 79 +++++++++-----------
 1 file changed, 37 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a949d55e/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/exception-frame.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/exception-frame.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/exception-frame.coffee
index 759a4b9..3be3da8 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/exception-frame.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/exception-frame.coffee
@@ -1,5 +1,3 @@
-# Copyright 2012-2013 The Apache Software Foundation
-#
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
@@ -16,54 +14,51 @@
 #
 # Manages a special element used to present an HTML exception report from an Ajax request (where a non-markup response
 # was expected, including a partial page render response).
-define ["./dom", "underscore"],
-  (dom, _) ->
-    container = null
-    iframe = null
-    iframeDocument = null
+define ["./dom"], (dom) ->
 
-    write = (content) ->
-      # Clear current content:
-      iframeDocument.open()
-      # Write new content:
-      iframeDocument.write content
-      iframeDocument.close()
+  write = (container, content) ->
+    iframe = (container.findFirst "iframe").element
 
-    clear = ->
-      write ""
-      container.hide()
-      return false
+    # See http://xkr.us/articles/dom/iframe-document/
 
-    create = ->
-      return if container
+    iframeDocument = iframe.contentWindow or iframe.contentDocument
+    if iframeDocument.document
+      iframeDocument = iframeDocument.document
 
-      container = dom.create
-        class: "exception-container"
-        """
-          <iframe> </iframe>
-          <div>
-            <button class="pull-right btn btn-primary">
-              <i class="icon-remove icon-white"></i>
-              Close
-            </button>
-          </div>
-        """
+    # Clear current content:
+    iframeDocument.open()
+    # Write new content:
+    iframeDocument.write content
+    iframeDocument.close()
 
-      dom.body.append container.hide()
+  clear = ->
+    container = @closest '.exception-container'
+    container.remove()
+    return false
 
-      iframe = (container.findFirst "iframe").element
+  create = ->
 
-      # See http://xkr.us/articles/dom/iframe-document/
+    container = dom.create
+      class: "exception-container"
+      """
+        <iframe> </iframe>
+        <div>
+          <button class="pull-right btn btn-primary">
+            <i class="icon-remove icon-white"></i>
+            Close
+          </button>
+        </div>
+      """
 
-      iframeDocument = iframe.contentWindow or iframe.contentDocument
-      if iframeDocument.document
-        iframeDocument = iframeDocument.document
+    dom.body.append container.hide()
 
-      container.on "click", "button", clear
+    container.on "click", "button", clear
+    container
 
-    # Export single function:
+  # Export single function:
 
-    (exceptionContent) ->
-      create()
-      write exceptionContent
-      container.show()
\ No newline at end of file
+  (exceptionContent) ->
+    container = create()
+    write container, exceptionContent
+    container.show()
+    return
\ No newline at end of file