<script src="../../../http/tests/inspector/inspector-test.js"></script>
<script src="resources/obfuscated.js"></script>
+<script id="outline">function first(x,y) { }
+ var second = function(y
+ ,
+z) { }
+ Object = function(arg) {
+}
+ Object.prototype.functionOnPrototype = function ( a, b ,
+c, d ,
+ e , f ) { function innerFunction1() {
+ var innerFunction2 = function(arg1,arg2) {} } }
+/**
+ * @constructor
+ * @param {string} name
+ */
+window.Cat = function(name)
+{
+ this._name = name;
+}
+
+window.Cat.prototype = {
+ mew: function()
+ {
+ console.log("Mew!");
+ },
+
+ get name()
+ {
+ return this._name;
+ },
+
+ feed: function()
+ {
+ // noop
+ },
+
+ set name(newName)
+ {
+ this._name = newName;
+ }
+};
+</script>
+
<script>
-var test = function()
+function getScriptText()
{
+ return document.querySelector("#outline").textContent;
+}
+
+function test()
+{
+
var worker = Runtime.startWorker("script_formatter_worker");
- var parsedScript = "function first(x,y) { }\n var second = function(y \n , \nz) { }\n Object = function(arg) {\n}\n Object.prototype.functionOnPrototype = function ( a, b , \n c, d , \n e , f ) { function innerFunction1() {\n var innerFunction2 = function(arg1,arg2) {} } }";
worker.onmessage = InspectorTest.safeWrap(function(event)
{
InspectorTest.completeTest();
};
- worker.postMessage({ method: "javaScriptOutline", params: { content: parsedScript } });
+ InspectorTest.evaluateInPage("getScriptText()", onScriptText);
+ function onScriptText(result)
+ {
+ worker.postMessage({ method: "javaScriptOutline", params: { content: result.value } });
+ }
}
</script>