Merge the last green PGO changeset on mozilla-inbound into mozilla-central; a=me

This commit is contained in:
Ehsan Akhgari 2012-04-18 16:18:04 -04:00
commit 290887ede1
47 changed files with 424 additions and 126 deletions

View File

@ -3076,14 +3076,13 @@ function getMarkupDocumentViewer()
function FillInHTMLTooltip(tipElement)
{
var retVal = false;
// Don't show the tooltip if the tooltip node is a XUL element, a document or is disconnected.
if (tipElement.namespaceURI == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" ||
!tipElement.ownerDocument ||
// Don't show the tooltip if the tooltip node is a document or disconnected.
if (!tipElement.ownerDocument ||
(tipElement.ownerDocument.compareDocumentPosition(tipElement) & document.DOCUMENT_POSITION_DISCONNECTED))
return retVal;
const XLinkNS = "http://www.w3.org/1999/xlink";
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var titleText = null;
var XLinkTitleText = null;
@ -3105,7 +3104,8 @@ function FillInHTMLTooltip(tipElement)
}
while (!titleText && !XLinkTitleText && !SVGTitleText && tipElement) {
if (tipElement.nodeType == Node.ELEMENT_NODE) {
if (tipElement.nodeType == Node.ELEMENT_NODE &&
tipElement.namespaceURI != XULNS) {
titleText = tipElement.getAttribute("title");
if ((tipElement instanceof HTMLAnchorElement ||
tipElement instanceof HTMLAreaElement ||

View File

@ -724,7 +724,8 @@ SourceScripts.prototype = {
return;
}
if (this._trimUrlQuery(aUrl).slice(-3) == ".js") {
// Use JS mode for files with .js and .jsm extensions.
if (/\.jsm?$/.test(this._trimUrlQuery(aUrl))) {
DebuggerView.editor.setMode(SourceEditor.MODES.JAVASCRIPT);
} else {
DebuggerView.editor.setMode(SourceEditor.MODES.HTML);

View File

@ -257,6 +257,7 @@ Highlighter.prototype = {
{
this.emitEvent("pseudoclasstoggled", [aPseudo]);
this.updateInfobar();
this.moveInfobar();
},
/**
@ -501,6 +502,20 @@ Highlighter.prototype = {
menu = menu.cloneNode(true);
menu.id = "highlighter-node-menu";
let separator = this.chromeDoc.createElement("menuseparator");
menu.appendChild(separator);
menu.addEventListener("popupshowing", function() {
let items = menu.getElementsByClassName("highlighter-pseudo-class-menuitem");
let i = items.length;
while (i--) {
menu.removeChild(items[i]);
}
let fragment = this.buildPseudoClassMenu();
menu.appendChild(fragment);
}.bind(this), true);
nodemenu.appendChild(menu);
// <hbox id="highlighter-nodeinfobar-text"/>
@ -524,12 +539,6 @@ Highlighter.prototype = {
aParent.appendChild(container);
nodeInfobar.onclick = (function _onInfobarRightClick(aEvent) {
if (aEvent.button == 2) {
this.openPseudoClassMenu();
}
}).bind(this);
let barHeight = container.getBoundingClientRect().height;
this.nodeInfo = {
@ -542,23 +551,6 @@ Highlighter.prototype = {
};
},
/**
* Open the infobar's pseudo-class context menu.
*/
openPseudoClassMenu: function Highlighter_openPseudoClassMenu()
{
let menu = this.chromeDoc.createElement("menupopup");
menu.id = "infobar-context-menu";
let popupSet = this.chromeDoc.getElementById("mainPopupSet");
popupSet.appendChild(menu);
let fragment = this.buildPseudoClassMenu();
menu.appendChild(fragment);
menu.openPopup(this.nodeInfo.pseudoClassesBox, "end_before", 0, 0, true, false);
},
/**
* Create the menuitems for toggling the selection's pseudo-class state
*
@ -570,12 +562,14 @@ Highlighter.prototype = {
for (let i = 0; i < PSEUDO_CLASSES.length; i++) {
let pseudo = PSEUDO_CLASSES[i];
let item = this.chromeDoc.createElement("menuitem");
item.id = "highlighter-pseudo-class-menuitem-" + pseudo;
item.setAttribute("type", "checkbox");
item.setAttribute("label", pseudo);
item.className = "highlighter-pseudo-class-menuitem";
item.setAttribute("checked", DOMUtils.hasPseudoClassLock(this.node,
pseudo));
item.addEventListener("command",
this.pseudoClassLockToggled.bind(this, pseudo), false);
item.setAttribute("checked", DOMUtils.hasPseudoClassLock(this.node,
pseudo));
fragment.appendChild(item);
}
return fragment;

View File

@ -74,6 +74,7 @@ _BROWSER_FILES = \
browser_inspector_sidebarstate.js \
browser_inspector_treePanel_menu.js \
browser_inspector_pseudoclass_lock.js \
browser_inspector_pseudoClass_menu.js \
head.js \
$(NULL)

View File

@ -0,0 +1,87 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
let DOMUtils = Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
let pseudos = [":hover", ":active", ":focus"];
let doc;
let div;
let menu;
function test()
{
waitForExplicitFinish();
ignoreAllUncaughtExceptions();
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
doc = content.document;
waitForFocus(createDocument, content);
}, true);
content.location = "data:text/html,pseudo-class lock node menu tests";
}
function createDocument()
{
div = doc.createElement("div");
div.textContent = "test div";
doc.body.appendChild(div);
setupTests();
}
function setupTests()
{
Services.obs.addObserver(selectNode,
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
InspectorUI.openInspectorUI();
}
function selectNode()
{
Services.obs.removeObserver(selectNode,
InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
executeSoon(function() {
InspectorUI.highlighter.addListener("nodeselected", performTests);
InspectorUI.inspectNode(div);
});
}
function performTests()
{
InspectorUI.highlighter.removeListener("nodeselected", performTests);
menu = document.getElementById("highlighter-node-menu");
menu.addEventListener("popupshowing", testMenuItems, true);
menu.openPopup();
}
function testMenuItems()
{
menu.removeEventListener("popupshowing", testMenuItems, true);
for each (let pseudo in pseudos) {
let menuitem = document.getElementById("highlighter-pseudo-class-menuitem-"
+ pseudo);
ok(menuitem, pseudo + " menuitem exists");
menuitem.doCommand();
is(DOMUtils.hasPseudoClassLock(div, pseudo), true,
"pseudo-class lock has been applied");
}
finishUp();
}
function finishUp()
{
InspectorUI.closeInspectorUI();
doc = div = null;
gBrowser.removeCurrentTab();
finish();
}

View File

@ -552,6 +552,10 @@ CssHtmlTree.prototype = {
menuitem.disabled = disable;
let node = this.doc.popupNode;
if (!node) {
return;
}
if (!node.classList.contains("property-view")) {
while (node = node.parentElement) {
if (node.classList.contains("property-view")) {
@ -599,6 +603,10 @@ CssHtmlTree.prototype = {
computedViewCopyDeclaration: function si_computedViewCopyDeclaration(aEvent)
{
let node = this.doc.popupNode;
if (!node) {
return;
}
if (!node.classList.contains("property-view")) {
while (node = node.parentElement) {
if (node.classList.contains("property-view")) {
@ -622,6 +630,10 @@ CssHtmlTree.prototype = {
computedViewCopyProperty: function si_computedViewCopyProperty(aEvent)
{
let node = this.doc.popupNode;
if (!node) {
return;
}
if (!node.classList.contains("property-view")) {
while (node = node.parentElement) {
if (node.classList.contains("property-view")) {
@ -643,6 +655,10 @@ CssHtmlTree.prototype = {
computedViewCopyPropertyValue: function si_computedViewCopyPropertyValue(aEvent)
{
let node = this.doc.popupNode;
if (!node) {
return;
}
if (!node.classList.contains("property-view")) {
while (node = node.parentElement) {
if (node.classList.contains("property-view")) {

View File

@ -929,6 +929,10 @@ CssRuleView.prototype = {
// Copy property, copy property name & copy property value.
let node = this.doc.popupNode;
if (!node) {
return;
}
if (!node.classList.contains("ruleview-property") &&
!node.classList.contains("ruleview-computed")) {
while (node = node.parentElement) {
@ -1007,45 +1011,50 @@ CssRuleView.prototype = {
*/
_onCopyRule: function CssRuleView_onCopyRule(aEvent)
{
let terminator;
let node = this.doc.popupNode;
if (node.className != "ruleview-code") {
if (node.className == "ruleview-rule-source") {
node = node.nextElementSibling;
} else {
while (node = node.parentElement) {
if (node.className == "ruleview-code") {
break;
}
if (!node) {
return;
}
if (node.className != "rule-view-row") {
while (node = node.parentElement) {
if (node.className == "rule-view-row") {
break;
}
}
}
node = node.cloneNode();
if (node.className == "ruleview-code") {
// We need to strip expanded properties from the node because we use
// node.textContent below, which also gets text from hidden nodes. The
// simplest way to do this is to clone the node and remove them from the
// clone.
node = node.cloneNode();
let computed = node.querySelector(".ruleview-computedlist");
if (computed) {
computed.parentNode.removeChild(computed);
}
let computedLists = node.querySelectorAll(".ruleview-computedlist");
for (let computedList of computedLists) {
computedList.parentNode.removeChild(computedList);
}
let text = node.textContent;
let autosizers = node.querySelectorAll(".autosizer");
for (let autosizer of autosizers) {
autosizer.parentNode.removeChild(autosizer);
}
let selector = node.querySelector(".ruleview-selector").textContent;
let propertyNames = node.querySelectorAll(".ruleview-propertyname");
let propertyValues = node.querySelectorAll(".ruleview-propertyvalue");
// Format the rule
if (osString == "WINNT") {
text = text.replace(/{/g, "{\r\n ");
text = text.replace(/;/g, ";\r\n ");
text = text.replace(/\s*}/g, "\r\n}");
terminator = "\r\n";
} else {
text = text.replace(/{/g, "{\n ");
text = text.replace(/;/g, ";\n ");
text = text.replace(/\s*}/g, "\n}");
terminator = "\n";
}
clipboardHelper.copyString(text);
let out = selector + " {" + terminator;
for (let i = 0; i < propertyNames.length; i++) {
let name = propertyNames[i].textContent;
let value = propertyValues[i].textContent;
out += " " + name + ": " + value + ";" + terminator;
}
out += "}" + terminator;
clipboardHelper.copyString(out);
},
/**
@ -1056,6 +1065,10 @@ CssRuleView.prototype = {
_onCopyDeclaration: function CssRuleView_onCopyDeclaration(aEvent)
{
let node = this.doc.popupNode;
if (!node) {
return;
}
if (!node.classList.contains("ruleview-property") &&
!node.classList.contains("ruleview-computed")) {
while (node = node.parentElement) {
@ -1071,11 +1084,16 @@ CssRuleView.prototype = {
// simplest way to do this is to clone the node and remove them from the
// clone.
node = node.cloneNode();
let computed = node.querySelector(".ruleview-computedlist");
if (computed) {
computed.parentNode.removeChild(computed);
let computedLists = node.querySelectorAll(".ruleview-computedlist");
for (let computedList of computedLists) {
computedList.parentNode.removeChild(computedList);
}
clipboardHelper.copyString(node.textContent);
let propertyName = node.querySelector(".ruleview-propertyname").textContent;
let propertyValue = node.querySelector(".ruleview-propertyvalue").textContent;
let out = propertyName + ": " + propertyValue + ";";
clipboardHelper.copyString(out);
},
/**
@ -1086,6 +1104,9 @@ CssRuleView.prototype = {
_onCopyProperty: function CssRuleView_onCopyProperty(aEvent)
{
let node = this.doc.popupNode;
if (!node) {
return;
}
if (!node.classList.contains("ruleview-propertyname")) {
node = node.querySelector(".ruleview-propertyname");
@ -1104,6 +1125,9 @@ CssRuleView.prototype = {
_onCopyPropertyValue: function CssRuleView_onCopyPropertyValue(aEvent)
{
let node = this.doc.popupNode;
if (!node) {
return;
}
if (!node.classList.contains("ruleview-propertyvalue")) {
node = node.querySelector(".ruleview-propertyvalue");
@ -1140,6 +1164,7 @@ RuleEditor.prototype = {
_create: function RuleEditor_create()
{
this.element = this.doc.createElementNS(HTML_NS, "div");
this.element.className = "rule-view-row";
this.element._ruleEditor = this;
// Give a relative position for the inplace editor's measurement

View File

@ -8,6 +8,10 @@ let doc;
let stylePanel;
let cssHtmlTree;
XPCOMUtils.defineLazyGetter(this, "osString", function() {
return Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
});
function createDocument()
{
doc.body.innerHTML = '<style type="text/css"> ' +
@ -63,13 +67,14 @@ function checkCopyProperty()
info("Checking that cssHtmlTree.siBoundCopyDeclaration() returns the " +
"correct clipboard value");
let expectedPattern = "color: rgb\\(255, 255, 0\\);";
info("Expected pattern: " + expectedPattern);
SimpleTest.waitForClipboard(function CS_boundCopyPropCheck() {
return checkClipboardData(expectedPattern);
},
cssHtmlTree.siBoundCopyDeclaration,
checkCopyPropertyName, checkCopyPropertyName);
checkCopyPropertyName, function() {
failedClipboard(expectedPattern, checkCopyPropertyName);
});
}
function checkCopyPropertyName()
@ -77,13 +82,14 @@ function checkCopyPropertyName()
info("Checking that cssHtmlTree.siBoundCopyProperty() returns the " +
"correct clipboard value");
let expectedPattern = "color";
info("Expected pattern: " + expectedPattern);
SimpleTest.waitForClipboard(function CS_boundCopyPropNameCheck() {
return checkClipboardData(expectedPattern);
},
cssHtmlTree.siBoundCopyProperty,
checkCopyPropertyValue, checkCopyPropertyValue);
checkCopyPropertyValue, function() {
failedClipboard(expectedPattern, checkCopyPropertyValue);
});
}
function checkCopyPropertyValue()
@ -91,13 +97,14 @@ function checkCopyPropertyValue()
info("Checking that cssHtmlTree.siBoundCopyPropertyValue() returns the " +
"correct clipboard value");
let expectedPattern = "rgb\\(255, 255, 0\\)";
info("Expected pattern: " + expectedPattern);
SimpleTest.waitForClipboard(function CS_boundCopyPropValueCheck() {
return checkClipboardData(expectedPattern);
},
cssHtmlTree.siBoundCopyPropertyValue,
checkCopySelection, checkCopySelection);
checkCopySelection, function() {
failedClipboard(expectedPattern, checkCopySelection);
});
}
function checkCopySelection()
@ -119,12 +126,13 @@ function checkCopySelection()
"font-family: helvetica,sans-serif[\\r\\n]+" +
"font-size: 16px[\\r\\n]+" +
"font-variant: small-caps[\\r\\n]*";
info("Expected pattern: " + expectedPattern);
SimpleTest.waitForClipboard(function CS_boundCopyCheck() {
return checkClipboardData(expectedPattern);
},
cssHtmlTree.siBoundCopy, closeStyleInspector, closeStyleInspector);
cssHtmlTree.siBoundCopy, closeStyleInspector, function() {
failedClipboard(expectedPattern, closeStyleInspector);
});
}
function checkClipboardData(aExpectedPattern)
@ -134,6 +142,28 @@ function checkClipboardData(aExpectedPattern)
return expectedRegExp.test(actual);
}
function failedClipboard(aExpectedPattern, aCallback)
{
// Format expected text for comparison
let terminator = osString == "WINNT" ? "\r\n" : "\n";
aExpectedPattern = aExpectedPattern.replace(/\[\\r\\n\][+*]/g, terminator);
aExpectedPattern = aExpectedPattern.replace(/\\\(/g, "(");
aExpectedPattern = aExpectedPattern.replace(/\\\)/g, ")");
let actual = SpecialPowers.getClipboardData("text/unicode");
// Trim the right hand side of our strings. This is because expectedPattern
// accounts for windows sometimes adding a newline to our copied data.
aExpectedPattern = aExpectedPattern.trimRight();
actual = actual.trimRight();
dump("TEST-UNEXPECTED-FAIL | Clipboard text does not match expected ... " +
"results (escaped for accurate comparison):\n");
info("Actual: " + escape(actual));
info("Expected: " + escape(aExpectedPattern));
aCallback();
}
function closeStyleInspector()
{
Services.obs.addObserver(finishUp, "StyleInspector-closed", false);

View File

@ -3,6 +3,13 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
let doc;
let tempScope = {};
Cu.import("resource:///modules/devtools/CssRuleView.jsm", tempScope);
let inplaceEditor = tempScope._getInplaceEditorForSpan;
XPCOMUtils.defineLazyGetter(this, "osString", function() {
return Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
});
function createDocument()
{
@ -39,6 +46,30 @@ function openInspector()
InspectorUI.openInspectorUI();
}
function waitForEditorFocus(aParent, aCallback)
{
aParent.addEventListener("focus", function onFocus(evt) {
if (inplaceEditor(evt.target)) {
aParent.removeEventListener("focus", onFocus, true);
let editor = inplaceEditor(evt.target);
executeSoon(function() {
aCallback(editor);
});
}
}, true);
}
function waitForEditorBlur(aEditor, aCallback)
{
let input = aEditor.input;
input.addEventListener("blur", function onBlur() {
input.removeEventListener("blur", onBlur, false);
executeSoon(function() {
aCallback();
});
}, false);
}
function inspectorUIOpen()
{
Services.obs.removeObserver(inspectorUIOpen,
@ -78,12 +109,13 @@ function testClip()
" font-family: helvetica,sans-serif;[\\r\\n]+" +
" color: rgb\\(170, 170, 170\\);[\\r\\n]+" +
"}[\\r\\n]*";
info("Expected pattern: " + expectedPattern);
SimpleTest.waitForClipboard(function IUI_boundCopyPropCheck() {
return checkClipboardData(expectedPattern);
},
checkCopyRule, checkCopyProperty, checkCopyProperty);
checkCopyRule, checkCopyRuleWithEditorSelected, function() {
failedClipboard(expectedPattern, checkCopyRuleWithEditorSelected);
});
});
}
@ -107,20 +139,86 @@ function checkCopyRule() {
ruleView.contentWindow);
InspectorUI.ruleView._boundCopyRule();
let menu = contentDoc.querySelector("#rule-view-context-menu");
ok(menu, "we have the context menu");
menu.hidePopup();
}
function checkCopyRuleWithEditorSelected()
{
let ruleView = document.querySelector("#devtools-sidebar-iframe-ruleview");
let contentDoc = ruleView.contentDocument;
let rows = contentDoc.querySelectorAll(".rule-view-row");
let propNodes = contentDoc.querySelectorAll(".ruleview-property");
let propNode = propNodes[2];
let propNameNode = propNode.querySelector(".ruleview-propertyname");
ok(propNameNode, "we have the property name node");
info("Checking that _boundCopyRule() returns the correct clipboard value");
let expectedPattern = "element {[\\r\\n]+" +
" margin: 10em;[\\r\\n]+" +
" font-size: 14pt;[\\r\\n]+" +
" font-family: helvetica,sans-serif;[\\r\\n]+" +
" color: rgb\\(170, 170, 170\\);[\\r\\n]+" +
"}[\\r\\n]*";
let elementRuleEditor = rows[0]._ruleEditor;
waitForEditorFocus(elementRuleEditor.element, function onNewElement(aEditor) {
ok(aEditor, "we have the editor");
waitForBlur.editor = aEditor;
// We need the context menu to open in the correct place in order for
// popupNode to be propertly set.
EventUtils.synthesizeMouse(aEditor.input, 1, 1,
{ type: "contextmenu", button: 2 }, ruleView.contentWindow);
SimpleTest.waitForClipboard(function IUI_boundCopyCheckWithSelection() {
let menu = contentDoc.querySelector("#rule-view-context-menu");
ok(menu, "we have the context menu");
menu.hidePopup();
return checkClipboardData(expectedPattern);
}, InspectorUI.ruleView._boundCopyRule, waitForBlur, function() {
failedClipboard(expectedPattern, checkCopyProperty);
});
});
EventUtils.synthesizeMouse(propNameNode, 1, 1, { }, ruleView.contentWindow);
}
function waitForBlur()
{
waitForEditorBlur(waitForBlur.editor, function() {
waitForBlur.editor = null;
checkCopyProperty();
});
waitForBlur.editor.input.blur();
}
function checkCopyProperty()
{
let ruleView = document.querySelector("#devtools-sidebar-iframe-ruleview");
let contentDoc = ruleView.contentDocument;
let props = contentDoc.querySelectorAll(".ruleview-property");
let prop = props[2];
info("Checking that _onCopyDeclaration() returns " +
"the correct clipboard value");
let expectedPattern = "font-family: helvetica,sans-serif;";
info("Expected pattern: " + expectedPattern);
// We need the context menu to open in the correct place in order for
// popupNode to be propertly set.
EventUtils.synthesizeMouse(prop, 1, 1, { type: "contextmenu", button: 2 },
ruleView.contentWindow);
SimpleTest.waitForClipboard(function IUI_boundCopyPropCheck() {
return checkClipboardData(expectedPattern);
},
InspectorUI.ruleView._boundCopyDeclaration,
checkCopyPropertyName, checkCopyPropertyName);
return checkClipboardData(expectedPattern);
},
InspectorUI.ruleView._boundCopyDeclaration,
checkCopyPropertyName, function() {
failedClipboard(expectedPattern, checkCopyPropertyName);
});
}
function checkCopyPropertyName()
@ -128,13 +226,14 @@ function checkCopyPropertyName()
info("Checking that _onCopyProperty() returns " +
"the correct clipboard value");
let expectedPattern = "font-family";
info("Expected pattern: " + expectedPattern);
SimpleTest.waitForClipboard(function IUI_boundCopyPropNameCheck() {
return checkClipboardData(expectedPattern);
},
InspectorUI.ruleView._boundCopyProperty,
checkCopyPropertyValue, checkCopyPropertyValue);
return checkClipboardData(expectedPattern);
},
InspectorUI.ruleView._boundCopyProperty,
checkCopyPropertyValue, function() {
failedClipboard(expectedPattern, checkCopyPropertyValue);
});
}
function checkCopyPropertyValue()
@ -142,13 +241,14 @@ function checkCopyPropertyValue()
info("Checking that _onCopyPropertyValue() " +
" returns the correct clipboard value");
let expectedPattern = "helvetica,sans-serif";
info("Expected pattern: " + expectedPattern);
SimpleTest.waitForClipboard(function IUI_boundCopyPropValueCheck() {
return checkClipboardData(expectedPattern);
},
InspectorUI.ruleView._boundCopyPropertyValue,
checkCopySelection, checkCopySelection);
return checkClipboardData(expectedPattern);
},
InspectorUI.ruleView._boundCopyPropertyValue,
checkCopySelection, function() {
failedClipboard(expectedPattern, checkCopySelection);
});
}
function checkCopySelection()
@ -160,10 +260,12 @@ function checkCopySelection()
let range = document.createRange();
range.setStart(props[0], 0);
range.setEnd(props[4], 8);
ruleView.contentWindow.getSelection().addRange(range);
info("Checking that _onCopy() returns the correct" +
"clipboard value");
let selection = ruleView.contentWindow.getSelection();
selection.addRange(range);
info("Checking that _boundCopy() returns the correct" +
"clipboard value");
let expectedPattern = " margin: 10em;[\\r\\n]+" +
" font-size: 14pt;[\\r\\n]+" +
" font-family: helvetica,sans-serif;[\\r\\n]+" +
@ -171,11 +273,12 @@ function checkCopySelection()
"}[\\r\\n]+" +
"html {[\\r\\n]+" +
" color: rgb\\(0, 0, 0\\);[\\r\\n]*";
info("Expected pattern: " + expectedPattern);
SimpleTest.waitForClipboard(function IUI_boundCopyCheck() {
return checkClipboardData(expectedPattern);
},InspectorUI.ruleView._boundCopy, finishup, finishup);
return checkClipboardData(expectedPattern);
},InspectorUI.ruleView._boundCopy, finishup, function() {
failedClipboard(expectedPattern, finishup);
});
}
function checkClipboardData(aExpectedPattern)
@ -185,6 +288,28 @@ function checkClipboardData(aExpectedPattern)
return expectedRegExp.test(actual);
}
function failedClipboard(aExpectedPattern, aCallback)
{
// Format expected text for comparison
let terminator = osString == "WINNT" ? "\r\n" : "\n";
aExpectedPattern = aExpectedPattern.replace(/\[\\r\\n\][+*]/g, terminator);
aExpectedPattern = aExpectedPattern.replace(/\\\(/g, "(");
aExpectedPattern = aExpectedPattern.replace(/\\\)/g, ")");
let actual = SpecialPowers.getClipboardData("text/unicode");
// Trim the right hand side of our strings. This is because expectedPattern
// accounts for windows sometimes adding a newline to our copied data.
aExpectedPattern = aExpectedPattern.trimRight();
actual = actual.trimRight();
dump("TEST-UNEXPECTED-FAIL | Clipboard text does not match expected ... " +
"results (escaped for accurate comparison):\n");
info("Actual: " + escape(actual));
info("Expected: " + escape(aExpectedPattern));
aCallback();
}
function finishup()
{
InspectorUI.hideSidebar();

View File

@ -20,7 +20,7 @@ registerCleanupFunction(function() {
function test() {
Services.prefs.setBoolPref("devtools.gcli.enable", true);
addTab("http://example.com/browser/browser/devtools/webconsole/test//test-console.html");
addTab("http://example.com/browser/browser/devtools/webconsole/test/test-console.html");
browser.addEventListener("DOMContentLoaded", onLoad, false);
}

View File

@ -40,7 +40,7 @@
// Tests that the input field is focused when the console is opened.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -41,7 +41,7 @@
// Tests to ensure that errors don't appear when the console is closed while a
// completion is being performed.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -40,7 +40,7 @@
// Tests that console groups behave properly.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -41,7 +41,7 @@
// Tests that exceptions thrown by content don't show up twice in the Web
// Console.
const TEST_DUPLICATE_ERROR_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-duplicate-error.html";
const TEST_DUPLICATE_ERROR_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-duplicate-error.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -37,7 +37,7 @@
*
* ***** END LICENSE BLOCK ***** */
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/browser/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -8,7 +8,7 @@
*
* ***** END LICENSE BLOCK ***** */
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -8,7 +8,7 @@
*
* ***** END LICENSE BLOCK ***** */
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
let HUD;
let outputItem;

View File

@ -8,7 +8,7 @@
*
* ***** END LICENSE BLOCK ***** */
const TESTS_PATH = "http://example.com/browser/browser/devtools/webconsole/test//";
const TESTS_PATH = "http://example.com/browser/browser/devtools/webconsole/test/";
const TESTS = [
{ // #0
file: "test-bug-595934-css-loader.html",

View File

@ -8,7 +8,7 @@
*
* ***** END LICENSE BLOCK ***** */
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
let testEnded = false;
let pos = -1;

View File

@ -38,7 +38,7 @@
// Tests that network log messages bring up the network panel.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-bug-618078-network-exceptions.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-618078-network-exceptions.html";
let testEnded = false;

View File

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);

View File

@ -7,7 +7,7 @@
* Mihai Sucan <mihai.sucan@gmail.com>
*/
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-bug-621644-jsterm-dollar.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-621644-jsterm-dollar.html";
function tabLoad(aEvent) {
browser.removeEventListener(aEvent.type, arguments.callee, true);

View File

@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-bug-632275-getters.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-632275-getters.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-bug-632347-iterators-generators.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-bug-632347-iterators-generators.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -38,7 +38,7 @@
// Tests for bug 704295
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -40,7 +40,7 @@
// Tests that code completion works properly.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -40,7 +40,7 @@
// Tests that the basic console.log()-style APIs and filtering work.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -9,7 +9,7 @@
*
* ***** END LICENSE BLOCK ***** */
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-own-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-own-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -40,7 +40,7 @@
// Tests that commands run by the user are executed in content space.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -3,7 +3,7 @@
// A for-of loop in Web Console code can loop over a content NodeList.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-for-of.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-for-of.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -40,7 +40,7 @@
// Tests the console history feature accessed via the up and down arrow keys.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
// Constants used for defining the direction of JSTerm input history navigation.
const HISTORY_BACK = -1;

View File

@ -41,7 +41,7 @@
// Tests that the HUD can be accessed via the HUD references in the HUD
// service.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -41,7 +41,7 @@
// Tests that the correct CSS styles are applied to the lines of console
// output.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -40,7 +40,7 @@
// Tests that the input box expands as the user types long lines.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -39,7 +39,7 @@
*
* ***** END LICENSE BLOCK ***** */
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
let jsterm;

View File

@ -41,7 +41,7 @@
// Test that JavaScript expressions that evaluate to null or undefined produce
// meaningful output.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -41,7 +41,7 @@
// Tests that any output created from calls to the console API comes after the
// echoed JavaScript.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -41,7 +41,7 @@
// Tests the functionality of the "property panel", which allows JavaScript
// objects and DOM nodes to be inspected.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -41,7 +41,7 @@
// Tests the property provider, which is part of the code completion
// infrastructure.
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//test-console.html";
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
registerCleanupFunction(function() {
Services.prefs.clearUserPref("devtools.gcli.enable");

View File

@ -639,7 +639,13 @@ nsCORSListenerProxy::OnStopRequest(nsIRequest* aRequest,
nsISupports* aContext,
nsresult aStatusCode)
{
return mOuterListener->OnStopRequest(aRequest, aContext, aStatusCode);
nsresult rv = mOuterListener->OnStopRequest(aRequest, aContext, aStatusCode);
mOuterListener = nsnull;
mOuterNotificationCallbacks = nsnull;
mRedirectCallback = nsnull;
mOldRedirectChannel = nsnull;
mNewRedirectChannel = nsnull;
return rv;
}
NS_IMETHODIMP
@ -1026,6 +1032,9 @@ nsCORSPreflightListener::OnStopRequest(nsIRequest *aRequest,
nsISupports *aContext,
nsresult aStatus)
{
mOuterChannel = nsnull;
mOuterListener = nsnull;
mOuterContext = nsnull;
return NS_OK;
}

View File

@ -2502,6 +2502,7 @@ nsXMLHttpRequest::ChangeStateToDone()
// methods/members will not throw.
// This matches what IE does.
mChannel = nsnull;
mCORSPreflightChannel = nsnull;
}
else if (!(mState & XML_HTTP_REQUEST_GOT_FINAL_STOP)) {
// We're a multipart request, so we're not done. Reset to opened.

View File

@ -0,0 +1,4 @@
/* should not crash on SPARC */
var http_string = 'https://easylist-downloads.adblockplus.org/easylist.txt';
var regexp = /^[\w\-]+:\/+(?!\/)(?:[^.\/]+\.)*?reports\.adblockplus\.org(?:[\x00-\x24\x26-\x2C\x2F\x3A-\x40\x5B-\x5E\x60\x7B-\x80]|$)/i;
assertEq(http_string.match(regexp), null);

View File

@ -607,6 +607,9 @@ PopupNotifications.prototype = {
}
}, this);
while (this.panel.lastChild)
this.panel.removeChild(this.panel.lastChild);
this._update();
},

View File

@ -469,6 +469,8 @@ LoadDirsIntoArray(nsCOMArray<nsIFile>& aSourceDirs,
aAppendList,
aDirectories);
}
else if (NS_SUCCEEDED(appended->Exists(&exists)) && exists)
aDirectories.AppendObject(appended);
}
}

View File

@ -513,7 +513,7 @@ void TableTicker::doBacktrace(ThreadProfile &aProfile, TickSample* aSample)
nsresult rv = NS_StackWalk(StackWalkCallback, 0, &array, thread);
#endif
if (NS_SUCCEEDED(rv)) {
aProfile.addTag(ProfileEntry('s', "(root)", 0));
aProfile.addTag(ProfileEntry('s', "(root)"));
for (size_t i = array.count; i > 0; --i) {
aProfile.addTag(ProfileEntry('l', (const char*)array.array[i - 1]));