Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<!-- | ||
STEPS TO CREATE A TEST CASE: | ||
5. Add the exact steps to reproduce the test case under "Steps to reproduce" | ||
6. Describe what is expected to see under "Expected result" | ||
7. Add your contact information | ||
8. Remove all template comments | ||
--> | ||
<head> | ||
<!-- | ||
Add the issue number and title here. | ||
--> | ||
<title>Issue 6268: Expose a clean "console" object to the Command Line</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
<link href="../../_common/testcase.css" type="text/css" rel="stylesheet"/> | ||
<script> | ||
// hack console.debug from the webpage: | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
var numberOfCalls = 0; | ||
console.log = function(invokerName) | ||
{ | ||
numberOfCalls++; | ||
} | ||
function setExpandos() | ||
{ | ||
// console expandos: | ||
console.expando = "webpage"; | ||
console.webpageExpando = "webpage"; | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<header> | ||
<h1><a href="http://code.google.com/p/fbug/issues/detail?id=6268">Issue 6268</a>: Expose a clean "console" object to the Command Line</h1> | ||
</header> | ||
<div> | ||
<section id="content"> | ||
<button onclick="setExpandos()" id="setExpandos">Set console expandos</button> | ||
<button onclick="console.log()" id="hackedConsoleLog">Hacked console.log</button> | ||
</section> | ||
<section id="description"> | ||
<!-- | ||
The steps to reproduce the test case should be described here in detail. | ||
--> | ||
<h3>Steps to reproduce</h3> | ||
<ol> | ||
<li>Open Firebug</li> | ||
<li>Enable and switch to the Console Panel</li> | ||
<li>Execute: <code>console === window.console</code> (should return <code>false</code>)</li> | ||
<li>Execute: <code>console.expando = "commandLine"</code></li> | ||
<li>Click on the <i>Set console expandos</i> button</li> | ||
<li>Execute: <code>console.expando</code> (should return <code>"commandLine"</code></li> | ||
<li>Execute: <code>console.webpageExpando</code> (should return <code>"webpage"</code></li> | ||
<li>Execute: <code>console.log("commandLine")</code> (should display <code>"commandLine"</code></li> | ||
<li>Execute: <code>window.console.log("console")</code></li> | ||
<li>Click on "Hacked console.log"</li> | ||
<li>Execute: <code>console.log = function(){window.hackedFromCL = true;}</code> | ||
<li>Click again on "Hacked console.log"</li> | ||
<li>Execute: <code>hackedFromCL</code> (should return true)</li> | ||
<li>Execute: <code>numberOfCalls</code> (should be 2)</li> | ||
<li>Execute: <code>console.debug() === "_firebugIgnore"</code> (should be <code>true</code>)</li> | ||
<li>Execute: <code>window.console.debug() === undefined</code> (should be <code>true</code>)</li> | ||
</ol> | ||
</section> | ||
<footer> | ||
Florent FAYOLLE, florent.fayolle69@gmail.com | ||
</footer> | ||
</div> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
function runTest() | ||
{ | ||
FBTest.sysout("issue6268.START"); | ||
|
||
FBTest.openNewTab(basePath + "console/6268/issue6268.html", function(win) | ||
{ | ||
FBTest.openFirebug(); | ||
|
||
FBTest.enableConsolePanel(function(win) | ||
{ | ||
var $id = document.getElementById.bind(win.document); | ||
FBTest.selectPanel("console"); | ||
var tasks = new FBTest.TaskList(); | ||
|
||
// 3. | ||
tasks.push(FBTest.executeCommandAndVerify, "console === window.console", "false", | ||
"span", "objectBox-number"); | ||
// 4. | ||
tasks.wrapAndPush(FBTest.executeCommand, "console.expando = 'commandLine'"); | ||
// 5. | ||
tasks.wrapAndPush(FBTest.click, $id("setExpandos"), win); | ||
// 6. | ||
tasks.push(FBTest.executeCommandAndVerify, "console.expando", '"commandLine"', | ||
"span", "objectBox-string"); | ||
// 7. | ||
tasks.push(FBTest.executeCommandAndVerify, "console.webpageExpando", '"webpage"', | ||
"span", "objectBox-string"); | ||
// 8. | ||
tasks.push(FBTest.executeCommandAndVerify, "console.log('commandLine');", | ||
"commandLine", "div", "logRow-log"); | ||
// 9. | ||
tasks.wrapAndPush(FBTest.executeCommand, "window.console.log('console');"); | ||
// 10. | ||
tasks.wrapAndPush(FBTest.click, $id("hackedConsoleLog"), win); | ||
// 11. | ||
tasks.wrapAndPush(FBTest.executeCommand, | ||
"console.log = function(){window.hackedFromCL = true;}"); | ||
// 12. | ||
tasks.wrapAndPush(FBTest.click, $id("hackedConsoleLog"), win); | ||
// 13. | ||
tasks.push(FBTest.executeCommandAndVerify, "hackedFromCL", "true", "span", | ||
"objectBox-number"); | ||
// 14. | ||
tasks.push(FBTest.executeCommandAndVerify, "window.numberOfCalls", 2, "span", | ||
"objectBox-number"); | ||
// 15. | ||
tasks.push(FBTest.executeCommandAndVerify, "console.debug() === '_firebugIgnore'", | ||
"true", "span", "objectBox-number"); | ||
// 16. | ||
tasks.push(FBTest.executeCommandAndVerify, | ||
"window.console.debug() === undefined", "true", "span", "objectBox-number"); | ||
|
||
tasks.run(function() | ||
{ | ||
FBTest.testDone("issue6268.DONE"); | ||
}); | ||
}); | ||
}); | ||
} | ||
|
||
function click(callback, win, id) | ||
{ | ||
FBTest.click(win.document.getElementById(id)); | ||
callback(); | ||
} |
3 comments
on commit 58d880b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test also that window.console.warn("") === undefined
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I test at step 16 that window.console.debug() === undefined
.
What case this test would cover that the above step does not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I missed it. Then it's fine. :)
console.log
, I guess.