Skip to content

Commit

Permalink
added document DOMContentLoaded bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Istiaque Ahmed committed Jun 12, 2013
1 parent 16c5611 commit 5575b27
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions tmp/webview_jq/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New style simple (chromium) platform app.
18 changes: 18 additions & 0 deletions tmp/webview_jq/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--
* Copyright 2013 The Chromium Authors. All rights reserved. Use of this
* source code is governed by a BSD-style license that can be found in the
* LICENSE file.
-->
<html>
<head>
<script type="text/javascript" src="pre.js"></script>
<!--
<script type="text/javascript" src="jquery-2.0.2.min.js"></script>
-->
<script type="text/javascript" src="main.js"></script>
</head>
<body>
<div>Embedder</div>
<webview style="height: 200px;" src="data:text/html,<body>Guest 0</body>"></webview>
</body>
</html>
21 changes: 21 additions & 0 deletions tmp/webview_jq/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var testD = function() {
/*
console.log('start testD');
var webview = document.createElement('webview');
webview.setAttribute('id', 'webview');
webview.setAttribute('src', 'data:text/html,<body>Guest 1</body>');
var firstLoad = function() {
window.console.log('first load');
webview.removeEventListener('loadstop', firstLoad);
window.console.log('first load done');
};
webview.addEventListener('loadstop', firstLoad);
document.body.appendChild(webview);
*/
};

window.onload = function() {
testD();
};

14 changes: 14 additions & 0 deletions tmp/webview_jq/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"manifest_version": 2,
"name": "<webview>.JQuery",
"version": "1",
"minimum_chrome_version": "23",
"permissions": [
"webview"
],
"app": {
"background": {
"scripts": ["test.js"]
}
}
}
15 changes: 15 additions & 0 deletions tmp/webview_jq/pre.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
window.console.log('app: add listener for doc.load');
window.addEventListener('DOMContentLoaded', function(e) {
window.console.log('document.DOMContentLoaded');
window.console.log('window.FOO = ' + window.FOO);
var w = document.querySelector('webview');
window.console.log('webview: ' + w);
window.console.log('try to Object.defineProperty');
Object.defineProperty(w, 'name', {
get: function() { return 'foo-name'; },
set: function(value) { window.console.log('ignore setting name: ' + name); },
enumerable: true
});
//document.body.appendChild(w);
window.console.log('done try to Object.defineProperty');
});
11 changes: 11 additions & 0 deletions tmp/webview_jq/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Listens for the app launching then creates the window
*
* @see http://developer.chrome.com/trunk/apps/app.runtime.html
* @see http://developer.chrome.com/trunk/apps/app.window.html
*/
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('main.html', {width: 500, height: 300});
});

window.console.log('*** test.js: ' + window.FOO);

0 comments on commit 5575b27

Please sign in to comment.