incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmue...@apache.org
Subject [2/12] git commit: remove the ExceptionalCallback stuff
Date Tue, 03 Jan 2012 18:44:10 GMT
remove the ExceptionalCallback stuff

   bug: removeEventListener broken
   https://issues.apache.org/jira/browse/CB-82

Remove the "new" ExceptionalCallback class, calls
to the class, and examples in the demo.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/commit/9cc3cf33
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/tree/9cc3cf33
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/diff/9cc3cf33

Branch: refs/heads/develop
Commit: 9cc3cf33c2e929a6b077b229fc0c4ce2c3367dbc
Parents: 041490b
Author: Patrick Mueller <pmuellr@yahoo.com>
Authored: Wed Nov 30 15:16:50 2011 -0500
Committer: Patrick Mueller <pmuellr@yahoo.com>
Committed: Wed Nov 30 15:16:50 2011 -0500

----------------------------------------------------------------------
 weinre.web/demo/weinre-demo-min.html               |   10 --
 weinre.web/demo/weinre-demo.html                   |   10 --
 weinre.web/demo/weinre-demo.js                     |   51 --------
 .../weinre/target/ExceptionalCallbacks.coffee      |  100 ---------------
 weinre.web/modules/weinre/target/Target.coffee     |    2 -
 5 files changed, 0 insertions(+), 173 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9cc3cf33/weinre.web/demo/weinre-demo-min.html
----------------------------------------------------------------------
diff --git a/weinre.web/demo/weinre-demo-min.html b/weinre.web/demo/weinre-demo-min.html
index 61e5070..95893a3 100644
--- a/weinre.web/demo/weinre-demo-min.html
+++ b/weinre.web/demo/weinre-demo-min.html
@@ -24,16 +24,6 @@
 <p>Some text, <i>some italic text</i>, and <b>some bold text</b>.
 
 <hr>
-<p>test exceptions in callbacks:
-<div style="margin-left:1em">
-    <input id="button-error-DOM-event"    type="button" value="DOM addEventHandler">
-<br><input id="button-error-window-event" type="button" value="window addEventHandler">
-<br><input id="button-error-XHR-event"    type="button" value="XHR addEventHandler">
-<br><input id="button-error-setTimeout"   type="button" value="setTimeout()">
-<br><input id="button-error-setInterval"  type="button" value="setInterval()">
-</div>
-
-<hr>
 <p><input id="button-clear-output" type="button" value="clear output">
 <div id="output"></div>
 </body>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9cc3cf33/weinre.web/demo/weinre-demo.html
----------------------------------------------------------------------
diff --git a/weinre.web/demo/weinre-demo.html b/weinre.web/demo/weinre-demo.html
index 58e003b..70c887e 100644
--- a/weinre.web/demo/weinre-demo.html
+++ b/weinre.web/demo/weinre-demo.html
@@ -24,16 +24,6 @@
 <p>Some text, <i>some italic text</i>, and <b>some bold text</b>.
 
 <hr>
-<p>test exceptions in callbacks:
-<div style="margin-left:1em">
-    <input id="button-error-DOM-event"    type="button" value="DOM addEventHandler">
-<br><input id="button-error-window-event" type="button" value="window addEventHandler">
-<br><input id="button-error-XHR-event"    type="button" value="XHR addEventHandler">
-<br><input id="button-error-setTimeout"   type="button" value="setTimeout()">
-<br><input id="button-error-setInterval"  type="button" value="setInterval()">
-</div>
-
-<hr>
 <p><input id="button-clear-output" type="button" value="clear output">
 <div id="output"></div>
 </body>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9cc3cf33/weinre.web/demo/weinre-demo.js
----------------------------------------------------------------------
diff --git a/weinre.web/demo/weinre-demo.js b/weinre.web/demo/weinre-demo.js
index b95a50f..5e36af4 100644
--- a/weinre.web/demo/weinre-demo.js
+++ b/weinre.web/demo/weinre-demo.js
@@ -10,11 +10,6 @@ var started = false
 
 var buttonStartStuff
 var buttonClearOutput
-var buttonErrorDOMEvent
-var buttonErrorWindowEvent
-var buttonErrorXHREvent
-var buttonErrorSetTimeout
-var buttonErrorSetInterval
 var outputElement
 var storageIndex = 0
 var db
@@ -29,11 +24,6 @@ window.WeinreServerId = hash
 function onLoad() {
     if (!buttonStartStuff)       buttonStartStuff       = document.getElementById("button-start-stuff")
     if (!buttonClearOutput)      buttonClearOutput      = document.getElementById("button-clear-output")
-    if (!buttonErrorDOMEvent)    buttonErrorDOMEvent    = document.getElementById("button-error-DOM-event")
-    if (!buttonErrorWindowEvent) buttonErrorWindowEvent = document.getElementById("button-error-window-event")
-    if (!buttonErrorXHREvent)    buttonErrorXHREvent    = document.getElementById("button-error-XHR-event")
-    if (!buttonErrorSetTimeout)  buttonErrorSetTimeout  = document.getElementById("button-error-setTimeout")
-    if (!buttonErrorSetInterval) buttonErrorSetInterval = document.getElementById("button-error-setInterval")
     if (!outputElement)          outputElement          = document.getElementById("output")
 
     buttonStartStuff.addEventListener("click", function() {
@@ -53,37 +43,6 @@ function onLoad() {
         started = !started
     })
 
-    buttonErrorDOMEvent.addEventListener("click", function buttonClicked() {
-        willThrowError()
-    })
-
-    buttonErrorWindowEvent.addEventListener("click", function() {
-        var event = document.createEvent("Events")
-        event.initEvent("demo", true, true)
-        window.dispatchEvent(event)
-    })
-
-    window.addEventListener("demo", willThrowError)
-
-    buttonErrorXHREvent.addEventListener("click", function() {
-        var xhr = new XMLHttpRequest()
-        xhr.addEventListener("readystatechange", willThrowError)
-        xhr.open("GET", "something.that.doesn't.exist")
-        xhr.send()
-    })
-
-    buttonErrorSetTimeout.addEventListener("click", function() {
-        setTimeout(willThrowError, 1000)
-    })
-
-    buttonErrorSetInterval.addEventListener("click", function() {
-        var intervalID
-
-        setTimeout(function() {clearInterval(intervalID)}, 3000)
-
-        intervalID = setInterval(willThrowError, 1000)
-    })
-
     buttonClearOutput.addEventListener("click", function() {
         outputElement.innerHTML = ""
     })
@@ -92,16 +51,6 @@ function onLoad() {
 }
 
 //------------------------------------------------------------------------------
-function willThrowError() {
-    throwsError()
-}
-
-function throwsError() {
-    x = null
-    x.doSomething()
-}
-
-//------------------------------------------------------------------------------
 var interval
 
 function startStuff() {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9cc3cf33/weinre.web/modules/weinre/target/ExceptionalCallbacks.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/target/ExceptionalCallbacks.coffee b/weinre.web/modules/weinre/target/ExceptionalCallbacks.coffee
deleted file mode 100644
index 0ab94ee..0000000
--- a/weinre.web/modules/weinre/target/ExceptionalCallbacks.coffee
+++ /dev/null
@@ -1,100 +0,0 @@
-
-#---------------------------------------------------------------------------------
-# weinre is available under *either* the terms of the modified BSD license *or* the
-# MIT License (2008). See http:#opensource.org/licenses/alphabetical for full text.
-#
-# Copyright (c) 2010, 2011 IBM Corporation
-#---------------------------------------------------------------------------------
-
-Ex        = require('../common/Ex')
-HookSites = require('./HookSites')
-
-#-------------------------------------------------------------------------------
-module.exports = class ExceptionalCallbacks
-
-    @addHooks: ->
-        addHookTimer HookSites.window_setInterval, callSite_setInterval
-        addHookTimer HookSites.window_setTimeout,  callSite_setTimeout
-
-        addHookEventListener HookSites.window_addEventListener,         callSite_windowAEL
-        addHookEventListener HookSites.Node_addEventListener,           callSite_nodeAEL
-        addHookEventListener HookSites.XMLHttpRequest_addEventListener, callSite_xhrAEL
-
-#-------------------------------------------------------------------------------
-addHookTimer = (hookSite, formatter) ->
-    hookSite.addHooks
-        before:  (receiver, args) ->
-            code = args[0]
-            return unless typeof(code) is "function"
-
-            millis   = args[1]
-            callSite = formatter(millis, code)
-
-            args[0] = instrumentedCallback(code, callSite)
-
-#-------------------------------------------------------------------------------
-addHookEventListener = (hookSite, formatter) ->
-    hookSite.addHooks
-        before:  (receiver, args) ->
-            code = args[1]
-            return unless typeof(code) is "function"
-
-            event    = args[0]
-            callSite = formatter(event, code, receiver)
-
-            args[1] = instrumentedCallback(code, callSite)
-
-#-------------------------------------------------------------------------------
-instrumentedCallback = (code, callSite) ->
-    return code unless typeof(code) is "function"
-
-    instrumentedCode = ->
-        try
-            return code.apply(this, arguments)
-        catch e
-            console.error "exception in callback: #{e}"
-            console.error "  callsite: #{callSite}"
-
-            if e.stack
-                console.error "stack at time of exception:"
-                console.error e.stack
-
-            throw e
-
-    instrumentedCode
-
-#-------------------------------------------------------------------------------
-callSite_setTimeout = (time, func) ->
-    "setTimeout(#{getFunctionName(func)}, #{time})"
-
-#-------------------------------------------------------------------------------
-callSite_setInterval = (time, func) ->
-    "setInterval(#{getFunctionName(func)}, #{time})"
-
-#-------------------------------------------------------------------------------
-callSite_windowAEL = (event, func) ->
-    "window.addEventListener('#{event}', #{getFunctionName(func)})"
-
-#-------------------------------------------------------------------------------
-callSite_nodeAEL = (event, func, node) ->
-    node = node.nodeName if node.nodeName
-    "#{node}.addEventListener('#{event}', #{getFunctionName(func)})"
-
-#-------------------------------------------------------------------------------
-callSite_xhrAEL = (event, func) ->
-    "XMLHttpRequest.addEventListener('#{event}', #{getFunctionName(func)})"
-
-#-------------------------------------------------------------------------------
-getFunctionName = (func) ->
-    return func.displayName if func.displayName
-    return func.name if func.name
-    return '<anonymous>'
-
-#-------------------------------------------------------------------------------
-getStackTrace = (e) ->
-    return e.stack if e.stack
-
-    return null
-
-#-------------------------------------------------------------------------------
-require("../common/MethodNamer").setNamesForClass(module.exports)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9cc3cf33/weinre.web/modules/weinre/target/Target.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/target/Target.coffee b/weinre.web/modules/weinre/target/Target.coffee
index 2a843e0..fcbcfd9 100644
--- a/weinre.web/modules/weinre/target/Target.coffee
+++ b/weinre.web/modules/weinre/target/Target.coffee
@@ -17,7 +17,6 @@ CheckForProblems              = require('./CheckForProblems')
 NodeStore                     = require('./NodeStore')
 CSSStore                      = require('./CSSStore')
 ElementHighlighter            = require('./ElementHighlighter')
-ExceptionalCallbacks          = require('./ExceptionalCallbacks')
 InjectedScriptHostImpl        = require('./InjectedScriptHostImpl')
 NetworkRequest                = require('./NetworkRequest')
 WeinreTargetEventsImpl        = require('./WeinreTargetEventsImpl')
@@ -155,7 +154,6 @@ module.exports = class Target
             Target.handleError e
         ), false
 
-        ExceptionalCallbacks.addHooks()
         NetworkRequest.installNativeHooks()
 
     #---------------------------------------------------------------------------


Mime
View raw message