backout bug 632275 and bug 620832, a=rcampbell,orange

This commit is contained in:
Rob Campbell 2011-04-12 20:54:14 -03:00
parent e8f08e1263
commit 24d5295dc2
5 changed files with 8 additions and 117 deletions

View File

@ -3527,7 +3527,7 @@ let ConsoleAPIObserver = {
HUDService.logConsoleAPIMessage(hudId, aMessage.level, aMessage.arguments); HUDService.logConsoleAPIMessage(hudId, aMessage.level, aMessage.arguments);
} }
else if (aTopic == "quit-application-granted") { else if (aTopic == "quit-application-granted") {
HUDService.shutdown(); this.shutdown();
} }
}, },
@ -5845,7 +5845,7 @@ HUDWindowObserver = {
uninit: function HWO_uninit() uninit: function HWO_uninit()
{ {
Services.obs.removeObserver(this, "content-document-global-created"); Services.obs.removeObserver(this, "content-document-global-created");
Services.obs.removeObserver(this, "xpcom-shutdown"); HUDService.shutdown();
this.initialConsoleCreated = false; this.initialConsoleCreated = false;
}, },

View File

@ -134,20 +134,6 @@ function presentableValueFor(aObject)
} }
} }
/**
* Tells if the given function is native or not.
*
* @param function aFunction
* The function you want to check if it is native or not.
*
* @return boolean
* True if the given function is native, false otherwise.
*/
function isNativeFunction(aFunction)
{
return typeof aFunction == "function" && !("prototype" in aFunction);
}
/** /**
* Get an array of property name value pairs for the tree. * Get an array of property name value pairs for the tree.
* *
@ -159,33 +145,17 @@ function isNativeFunction(aFunction)
function namesAndValuesOf(aObject) function namesAndValuesOf(aObject)
{ {
let pairs = []; let pairs = [];
let value, presentable, getter; let value, presentable;
let isDOMDocument = aObject instanceof Ci.nsIDOMDocument;
for (var propName in aObject) { for (var propName in aObject) {
// See bug 632275: skip deprecated width and height properties. try {
if (isDOMDocument && (propName == "width" || propName == "height")) { value = aObject[propName];
presentable = presentableValueFor(value);
}
catch (ex) {
continue; continue;
} }
// Also skip non-native getters.
// TODO: implement a safer way to skip non-native getters. See bug 647235.
getter = aObject.__lookupGetter__(propName);
if (getter && !isNativeFunction(getter)) {
value = ""; // Value is never displayed.
presentable = {type: TYPE_OTHER, display: "Getter"};
}
else {
try {
value = aObject[propName];
presentable = presentableValueFor(value);
}
catch (ex) {
continue;
}
}
let pair = {}; let pair = {};
pair.name = propName; pair.name = propName;
pair.display = propName + ": " + presentable.display; pair.display = propName + ": " + presentable.display;

View File

@ -131,7 +131,6 @@ _BROWSER_TEST_FILES = \
browser_webconsole_bug_632347_iterators_generators.js \ browser_webconsole_bug_632347_iterators_generators.js \
browser_webconsole_bug_642108_refForOutputNode.js \ browser_webconsole_bug_642108_refForOutputNode.js \
browser_webconsole_bug_642108_pruneTest.js \ browser_webconsole_bug_642108_pruneTest.js \
browser_webconsole_bug_632275_getters_document_width.js \
head.js \ head.js \
$(NULL) $(NULL)
@ -200,7 +199,6 @@ _BROWSER_TEST_PAGES = \
test-bug-630733-response-redirect-headers.sjs \ test-bug-630733-response-redirect-headers.sjs \
test-bug-621644-jsterm-dollar.html \ test-bug-621644-jsterm-dollar.html \
test-bug-632347-iterators-generators.html \ test-bug-632347-iterators-generators.html \
test-bug-632275-getters.html \
$(NULL) $(NULL)
libs:: $(_BROWSER_TEST_FILES) libs:: $(_BROWSER_TEST_FILES)

View File

@ -1,58 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const TEST_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-bug-632275-getters.html";
function test() {
addTab(TEST_URI);
browser.addEventListener("load", tabLoaded, true);
}
function tabLoaded() {
browser.removeEventListener("load", tabLoaded, true);
openConsole();
let hudId = HUDService.getHudIdByWindow(content);
let HUD = HUDService.hudReferences[hudId];
let jsterm = HUD.jsterm;
let doc = content.wrappedJSObject.document;
let panel = jsterm.openPropertyPanel("Test1", doc);
let rows = panel.treeView._rows;
let find = function(regex) {
return rows.some(function(row) {
return regex.test(row.display);
});
};
ok(!find(/^(width|height):/), "no document.width/height");
panel.destroy();
let getterValue = doc.foobar._val;
panel = jsterm.openPropertyPanel("Test2", doc.foobar);
rows = panel.treeView._rows;
is(getterValue, doc.foobar._val, "getter did not execute");
is(getterValue+1, doc.foobar.val, "getter executed");
is(getterValue+1, doc.foobar._val, "getter executed (recheck)");
ok(find(/^val: Getter$/),
"getter is properly displayed");
ok(find(new RegExp("^_val: " + getterValue + "$")),
"getter _val is properly displayed");
panel.destroy();
executeSoon(function() {
let textContent = HUD.outputNode.textContent;
is(textContent.indexOf("document.body.client"), -1,
"no document.width/height warning displayed");
finishTest();
});
}

View File

@ -1,19 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Web Console test for bug 632275 - getters</title>
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<script type="application/javascript;version=1.8">
document.foobar = {
_val: 5,
get val() { return ++this._val; }
};
</script>
</head>
<body>
<p>Web Console test for bug 632275 - getters.</p>
</body>
</html>