Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Merge branch 'issue/10' into develop
  • Loading branch information
pmuellr committed Feb 25, 2011
2 parents ab9de32 + 51fbd53 commit ba06a1aa97c95203ab967d8b6475370abf6aa6ee
Show file tree
Hide file tree
Showing 20 changed files with 579 additions and 81 deletions.
@@ -47,6 +47,7 @@ def main():

baseScriptFile = match.group(1)
scriptFile = os.path.join(srcDirName, baseScriptFile)
if scriptFile == "weinre-demo.js": continue
if not os.path.exists(scriptFile): error("script file not found: '" + scriptFile + "'")

scripts.append(scriptFile)
@@ -7,30 +7,25 @@

<html>
<head>
<title>testing</title>
<meta name="viewport" content="user-scalable=no, width=device-width, height=device-height">
<title>weinre demo</title>
<link rel="stylesheet" href="weinre-demo.css">
<script src="/target/target-script-min.js"></script>

<style>
h1 {
color: green;
}
<script type="text/javascript">
require("weinre/common/Weinre").showNotImplemented()
require("weinre/target/Target").main()
</script>

.blue {
color: blue;
}

#metrics {
margin: 1em;
border: 0.2em solid;
padding: 3em;
}
</style>
<script src="weinre-demo.js"></script>
</head>

<body>
<h1>this is a green h1 element</h1>
<h1 class="blue">this is a blue h1 element</h1>
<h1 style="color:red">this is a red h1 element</h1>
<body onload="onLoad()">
<input id="button" type="button" value="start stuff">

<h1>this is a green h1</h1>
<h1 class="blue">this is a blue h1</h1>
<h1 style="color:red">this is a red h1</h1>
<p>Some text, <i>some italic text</i>, and <b>some bold text</b>.

<div id="metrics">a div</div>
@@ -7,7 +7,9 @@

<html>
<head>
<title>testing</title>
<meta name="viewport" content="user-scalable=no, width=device-width, height=device-height">
<title>weinre demo</title>
<link rel="stylesheet" href="weinre-demo.css">
<script src="/modjewel-require.js"></script>
<script type="text/javascript">require("modjewel").warnOnRecursiveRequire(true)</script>
<script src="/scooj.transportd.js"></script>
@@ -20,6 +22,8 @@
<script src="/weinre/common/Binding.transportd.js"></script>
<script src="/weinre/common/Callback.transportd.js"></script>
<script src="/weinre/common/EventListeners.transportd.js"></script>
<script src="/weinre/common/Native.transportd.js"></script>
<script src="/weinre/common/IDGenerator.transportd.js"></script>
<script src="/weinre/target/Console.transportd.js"></script>
<script src="/add-css-properties.js"></script>
<script src="/weinre/target/WiConsoleImpl.transportd.js"></script>
@@ -36,34 +40,23 @@
<script src="/weinre/target/Target.transportd.js"></script>
<script src="/weinre/target/ElementHighlighter.transportd.js"></script>
<script src="/weinre/target/InjectedScript.js"></script>
<script src="/weinre/target/Timeline.transportd.js"></script>
<script src="/interfaces/all-json-idls.js"></script>

<script type="text/javascript">
require("weinre/common/Weinre").showNotImplemented()
require("weinre/target/Target").main()
</script>

<style>
h1 {
color: green;
}

.blue {
color: blue;
}

#metrics {
margin: 1em;
border: 0.2em solid;
padding: 3em;
}
</style>
<script src="weinre-demo.js"></script>
</head>

<body>
<h1>this is a green h1 element</h1>
<h1 class="blue">this is a blue h1 element</h1>
<h1 style="color:red">this is a red h1 element</h1>
<body onload="onLoad()">
<input id="button" type="button" value="start stuff">

<h1>this is a green h1</h1>
<h1 class="blue">this is a blue h1</h1>
<h1 style="color:red">this is a red h1</h1>
<p>Some text, <i>some italic text</i>, and <b>some bold text</b>.

<div id="metrics">a div</div>
@@ -0,0 +1,24 @@
/*
* 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) 2011 IBM Corporation
*/

h1 {
color: green;
}

.blue {
color: blue;
}

#metrics {
margin: 1em;
border: 0.2em solid;
padding: 3em;
}

#button {
font-size: 150%;
}
@@ -7,30 +7,25 @@

<html>
<head>
<title>testing</title>
<meta name="viewport" content="user-scalable=no, width=device-width, height=device-height">
<title>weinre demo</title>
<link rel="stylesheet" href="weinre-demo.css">
<script src="/target/target-script.js"></script>

<style>
h1 {
color: green;
}
<script type="text/javascript">
require("weinre/common/Weinre").showNotImplemented()
require("weinre/target/Target").main()
</script>

.blue {
color: blue;
}

#metrics {
margin: 1em;
border: 0.2em solid;
padding: 3em;
}
</style>
<script src="weinre-demo.js"></script>
</head>

<body>
<h1>this is a green h1 element</h1>
<h1 class="blue">this is a blue h1 element</h1>
<h1 style="color:red">this is a red h1 element</h1>
<body onload="onLoad()">
<input id="button" type="button" value="start stuff">

<h1>this is a green h1</h1>
<h1 class="blue">this is a blue h1</h1>
<h1 style="color:red">this is a red h1</h1>
<p>Some text, <i>some italic text</i>, and <b>some bold text</b>.

<div id="metrics">a div</div>
@@ -0,0 +1,64 @@
/*
* 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) 2011 IBM Corporation
*/

//------------------------------------------------------------------------------
var started = false
var button

//------------------------------------------------------------------------------
function onLoad() {
if (!button) button = document.getElementById("button")

button.addEventListener("click", function() {
if (!started) {
button.value = "stop stuff"
startStuff()
}
else {
button.value = "start stuff"
stopStuff()
}
started = !started
})
}

//------------------------------------------------------------------------------
var interval

function startStuff() {
interval = setInterval(intervalStuff, 1000)
}

function stopStuff() {
clearInterval(interval)
}

//------------------------------------------------------------------------------
function intervalStuff() {
// add a timeout
setTimeout(function() { console.log("doing interval stuff")}, 333)

// add a timeline marker
console.markTimeline("doing interval Stuff")

// do an XHR
var xhr = new XMLHttpRequest()
// xhr.addEventListener("readystatechange", function() {logXhr(this)})
xhr.open("GET", "../target/target-script.js", true)
xhr.send()

// cause an error
var empty = null
empty.x = 1

}

//------------------------------------------------------------------------------
function logXhr(xhr) {
console.log("xhr: readyState: " + xhr.readyState)
}

@@ -44,7 +44,7 @@ <h2>Access Points</h2>
<table>
<tr><td>debug client user interface: <td> <span id="url-client-ui">???</span>
<tr><td>documentation: <td> <span id="url-target-documentation">???</span>
<tr><td>target demo: <td> <span id="url-target-demo">???</span> <br><i>(<span id="url-target-demo-pieces"></span>)</i>
<tr><td>target demo: <td> <span id="url-target-demo-min">???</span> <br><i>(<span id="url-target-demo-pieces"></span>)</i>
</table>

<h2>Target Bookmarklet</h2>
@@ -6,6 +6,8 @@
* Copyright (c) 2010, 2011 IBM Corporation
*/

requireClass ../common/Native

requireClass ../common/IDLTools
requireClass ../common/Callback
requireClass ../common/Weinre
@@ -48,6 +50,10 @@ method initialize

// register WebInspector interface
messageDispatcher.registerInterface("WebInspector", WebInspector, false)

// hack
WebInspector.mainResource = {}
WebInspector.mainResource.url = location.href

//-----------------------------------------------------------------------------
method uiAvailable
@@ -74,8 +80,8 @@ method _installRemotePanel

var toolButtonsToHide = ["scripts"]
toolButtonsToHide.forEach(function(toolButtonToHide){
if (!WebInspector.panels[toolButtonToHide]) continue
if (!WebInspector.panels[toolButtonToHide].toolbarItem) continue
if (!WebInspector.panels[toolButtonToHide]) return
if (!WebInspector.panels[toolButtonToHide].toolbarItem) return
WebInspector.panels[toolButtonToHide].toolbarItem.style.display = "none"
})

@@ -114,7 +120,7 @@ method cb_webSocketClosed

// use a delay, otherwise reloading will cause this stuff to flash
// before page is actually reloaded
setTimeout(function() {
Native.setTimeout(function() {
WebInspector.panels.remote.connectionClosed()
WebInspector.currentPanel = WebInspector.panels.remote
}, 1000)
@@ -65,7 +65,9 @@ static method getProxyMethod(proxy, method)
//-----------------------------------------------------------------------------
method registerDomainDispatcher(name, intf)
this.registeredDomainDispatchers[name] = intf

//-----------------------------------------------------------------------------
method getRegisteredDomainDispatcher(name)
if (!this.registeredDomainDispatchers.hasOwnProperty(name)) return null

return this.registeredDomainDispatchers[name]
@@ -23,7 +23,7 @@ method localizedStringsURL

//-----------------------------------------------------------------------------
method hiddenPanels
return "audits,profiles,resources,timeline,network"
return "audits,profiles,resources,network"
// return "audits,profiles,resources,scripts,timeline,network"

//-----------------------------------------------------------------------------
@@ -51,6 +51,9 @@ method connectionCreated(/*int*/ clientId, /*int*/ targetId)
if (clientId != Weinre.clientId) return

Weinre.targetId = targetId

WebInspector.panels.elements.reset()
WebInspector.panels.timeline._clearPanel()

//-----------------------------------------------------------------------------
method connectionDestroyed(/*int*/ clientId, /*int*/ targetId)
@@ -0,0 +1,20 @@

/*
* 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) 2011 IBM Corporation
*/

//-----------------------------------------------------------------------------
class IDGenerator

//-----------------------------------------------------------------------------
init
var nextId = 1

//-----------------------------------------------------------------------------
static method next
var result = nextId
nextId += 1
return result
@@ -156,7 +156,8 @@ method _handleMessage(message)

var methodSignature = intfName + "." + methodName + "()"

var intf = this._interfaces[intfName]
var intf = this._interfaces.hasOwnProperty(intfName) && this._interfaces[intfName]

if (!intf && InspectorBackend && intfName.match(/.*Notify/)) {
intf = InspectorBackend.getRegisteredDomainDispatcher(intfName.substr(0,intfName.length-6))
}
@@ -0,0 +1,29 @@

/*
* 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) 2011 IBM Corporation
*/

//-----------------------------------------------------------------------------
class Native

//-----------------------------------------------------------------------------
init
Native.original = {}

Native.original.clearInterval = window.clearInterval
Native.original.clearTimeout = window.clearTimeout
Native.original.setTimeout = window.setTimeout
Native.original.setInterval = window.setInterval
Native.original.XMLHttpRequest = window.XMLHttpRequest
Native.original.XMLHttpRequest_open = window.XMLHttpRequest.prototype.open

Native.clearInterval = function() { return Native.original.clearInterval.apply( window, [].slice.call(arguments))}
Native.clearTimeout = function() { return Native.original.clearTimeout.apply( window, [].slice.call(arguments))}
Native.setInterval = function() { return Native.original.setInterval.apply( window, [].slice.call(arguments))}
Native.setTimeout = function() { return Native.original.setTimeout.apply( window, [].slice.call(arguments))}
Native.XMLHttpRequest = function() { return new Native.original.XMLHttpRequest()}
Native.XMLHttpRequest_open = function() { return Native.original.XMLHttpRequest_open.apply(this, [].slice.call(arguments))}

0 comments on commit ba06a1a

Please sign in to comment.