From a6e8c3705ca22d5156b2142d6f5240b7d8ce34fe Mon Sep 17 00:00:00 2001 From: Pardal Freudenthal Date: Tue, 24 May 2011 09:27:40 -0300 Subject: [PATCH 01/15] Bug 633772 - Web Console cleanup: Use of inheritance to set icons on hud-msg-nodes; r=dao --- .../themes/gnomestripe/global/webConsole.css | 27 ++++++++++--------- .../themes/pinstripe/global/webConsole.css | 27 ++++++++++--------- .../themes/winstripe/global/webConsole.css | 27 ++++++++++--------- 3 files changed, 45 insertions(+), 36 deletions(-) diff --git a/toolkit/themes/gnomestripe/global/webConsole.css b/toolkit/themes/gnomestripe/global/webConsole.css index 8ded9ef5cdb..b32d7240d24 100644 --- a/toolkit/themes/gnomestripe/global/webConsole.css +++ b/toolkit/themes/gnomestripe/global/webConsole.css @@ -69,9 +69,12 @@ margin-bottom: 0; } -.webconsole-msg-icon { +.hud-msg-node { list-style-image: url(chrome://global/skin/icons/webconsole.png); -moz-image-region: rect(0, 1px, 0, 0); +} + +.webconsole-msg-icon { margin: 3px 4px; width: 8px; height: 8px; @@ -167,7 +170,7 @@ -moz-border-start: solid #000 6px; } -.webconsole-msg-network.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-network.webconsole-msg-error { -moz-image-region: rect(0, 16px, 8px, 8px); } @@ -180,11 +183,11 @@ -moz-border-start: solid #00b6f0 6px; } -.webconsole-msg-cssparser.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-cssparser.webconsole-msg-error { -moz-image-region: rect(8px, 16px, 16px, 8px); } -.webconsole-msg-cssparser.webconsole-msg-warn > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-cssparser.webconsole-msg-warn { -moz-image-region: rect(8px, 24px, 16px, 16px); } @@ -197,11 +200,11 @@ -moz-border-start: solid #fb9500 6px; } -.webconsole-msg-exception.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-exception.webconsole-msg-error { -moz-image-region: rect(16px, 16px, 24px, 8px); } -.webconsole-msg-exception.webconsole-msg-warn > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-exception.webconsole-msg-warn { -moz-image-region: rect(16px, 24px, 24px, 16px); } @@ -214,16 +217,16 @@ -moz-border-start: solid #cbcbcb 6px; } -.webconsole-msg-console.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon, -.webconsole-msg-output.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-console.webconsole-msg-error, +.webconsole-msg-output.webconsole-msg-error { -moz-image-region: rect(24px, 16px, 32px, 8px); } -.webconsole-msg-console.webconsole-msg-warn > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-console.webconsole-msg-warn { -moz-image-region: rect(24px, 24px, 32px, 16px); } -.webconsole-msg-console.webconsole-msg-info > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-console.webconsole-msg-info { -moz-image-region: rect(24px, 32px, 32px, 24px); } @@ -233,11 +236,11 @@ border-left: solid #808080 6px; } -.webconsole-msg-input > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-input { -moz-image-region: rect(24px, 40px, 32px, 32px); } -.webconsole-msg-output > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-output { -moz-image-region: rect(24px, 48px, 32px, 40px); } diff --git a/toolkit/themes/pinstripe/global/webConsole.css b/toolkit/themes/pinstripe/global/webConsole.css index e60477864d8..2b7f4622b2d 100644 --- a/toolkit/themes/pinstripe/global/webConsole.css +++ b/toolkit/themes/pinstripe/global/webConsole.css @@ -72,9 +72,12 @@ margin-bottom: 0; } -.webconsole-msg-icon { +.hud-msg-node { list-style-image: url(chrome://global/skin/icons/webconsole.png); -moz-image-region: rect(0, 1px, 0, 0); +} + +.webconsole-msg-icon { margin: 3px 4px; width: 8px; height: 8px; @@ -225,7 +228,7 @@ -moz-border-start: solid #000 6px; } -.webconsole-msg-network.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-network.webconsole-msg-error { -moz-image-region: rect(0, 16px, 8px, 8px); } @@ -238,11 +241,11 @@ -moz-border-start: solid #00b6f0 6px; } -.webconsole-msg-cssparser.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-cssparser.webconsole-msg-error { -moz-image-region: rect(8px, 16px, 16px, 8px); } -.webconsole-msg-cssparser.webconsole-msg-warn > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-cssparser.webconsole-msg-warn { -moz-image-region: rect(8px, 24px, 16px, 16px); } @@ -255,11 +258,11 @@ -moz-border-start: solid #fb9500 6px; } -.webconsole-msg-exception.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-exception.webconsole-msg-error { -moz-image-region: rect(16px, 16px, 24px, 8px); } -.webconsole-msg-exception.webconsole-msg-warn > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-exception.webconsole-msg-warn { -moz-image-region: rect(16px, 24px, 24px, 16px); } @@ -272,16 +275,16 @@ -moz-border-start: solid #cbcbcb 6px; } -.webconsole-msg-console.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon, -.webconsole-msg-output.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-console.webconsole-msg-error, +.webconsole-msg-output.webconsole-msg-error { -moz-image-region: rect(24px, 16px, 32px, 8px); } -.webconsole-msg-console.webconsole-msg-warn > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-console.webconsole-msg-warn { -moz-image-region: rect(24px, 24px, 32px, 16px); } -.webconsole-msg-console.webconsole-msg-info > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-console.webconsole-msg-info { -moz-image-region: rect(24px, 32px, 32px, 24px); } @@ -291,11 +294,11 @@ border-left: solid #808080 6px; } -.webconsole-msg-input.webconsole-msg-log > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-input { -moz-image-region: rect(24px, 40px, 32px, 32px); } -.webconsole-msg-output.webconsole-msg-log > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-output { -moz-image-region: rect(24px, 48px, 32px, 40px); } diff --git a/toolkit/themes/winstripe/global/webConsole.css b/toolkit/themes/winstripe/global/webConsole.css index 48d80ff4f6c..05e975acf85 100644 --- a/toolkit/themes/winstripe/global/webConsole.css +++ b/toolkit/themes/winstripe/global/webConsole.css @@ -68,9 +68,12 @@ margin-bottom: 0; } -.webconsole-msg-icon { +.hud-msg-node { list-style-image: url(chrome://global/skin/icons/webconsole.png); -moz-image-region: rect(0, 1px, 0, 0); +} + +.webconsole-msg-icon { margin: 3px 4px; width: 8px; height: 8px; @@ -165,7 +168,7 @@ -moz-border-start: solid #000 6px; } -.webconsole-msg-network.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-network.webconsole-msg-error { -moz-image-region: rect(0, 16px, 8px, 8px); } @@ -178,11 +181,11 @@ -moz-border-start: solid #00b6f0 6px; } -.webconsole-msg-cssparser.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-cssparser.webconsole-msg-error { -moz-image-region: rect(8px, 16px, 16px, 8px); } -.webconsole-msg-cssparser.webconsole-msg-warn > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-cssparser.webconsole-msg-warn { -moz-image-region: rect(8px, 24px, 16px, 16px); } @@ -195,11 +198,11 @@ -moz-border-start: solid #fb9500 6px; } -.webconsole-msg-exception.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-exception.webconsole-msg-error { -moz-image-region: rect(16px, 16px, 24px, 8px); } -.webconsole-msg-exception.webconsole-msg-warn > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-exception.webconsole-msg-warn { -moz-image-region: rect(16px, 24px, 24px, 16px); } @@ -212,16 +215,16 @@ -moz-border-start: solid #cbcbcb 6px; } -.webconsole-msg-console.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon, -.webconsole-msg-output.webconsole-msg-error > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-console.webconsole-msg-error, +.webconsole-msg-output.webconsole-msg-error { -moz-image-region: rect(24px, 16px, 32px, 8px); } -.webconsole-msg-console.webconsole-msg-warn > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-console.webconsole-msg-warn { -moz-image-region: rect(24px, 24px, 32px, 16px); } -.webconsole-msg-console.webconsole-msg-info > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-console.webconsole-msg-info { -moz-image-region: rect(24px, 32px, 32px, 24px); } @@ -231,11 +234,11 @@ border-left: solid #808080 6px; } -.webconsole-msg-input > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-input { -moz-image-region: rect(24px, 40px, 32px, 32px); } -.webconsole-msg-output > .webconsole-msg-icon-container > .webconsole-msg-icon { +.webconsole-msg-output { -moz-image-region: rect(24px, 48px, 32px, 40px); } From d1ed34946349596f29a7c566cbfdf4678ba59c75 Mon Sep 17 00:00:00 2001 From: Rob Campbell Date: Thu, 26 May 2011 14:38:09 -0300 Subject: [PATCH 02/15] Bug 653528 - Strip out Style and DOM panels and support code from Inspector.; r=gavin.sharp --- browser/base/Makefile.in | 1 - browser/base/content/browser.xul | 35 -- browser/base/content/inspector.js | 412 ++++-------------- browser/base/content/stylePanel.jsm | 315 ------------- browser/base/content/test/Makefile.in | 2 - .../test/browser_inspector_domPanel.js | 171 -------- .../test/browser_inspector_highlighter.js | 9 +- .../test/browser_inspector_initialization.js | 4 - .../test/browser_inspector_stylePanel.js | 124 ------ .../test/browser_inspector_tab_switch.js | 17 +- .../locales/en-US/chrome/browser/browser.dtd | 13 - .../en-US/chrome/browser/inspector.properties | 16 - browser/locales/jar.mn | 1 - 13 files changed, 91 insertions(+), 1029 deletions(-) delete mode 100644 browser/base/content/stylePanel.jsm delete mode 100644 browser/base/content/test/browser_inspector_domPanel.js delete mode 100644 browser/base/content/test/browser_inspector_stylePanel.js delete mode 100644 browser/locales/en-US/chrome/browser/inspector.properties diff --git a/browser/base/Makefile.in b/browser/base/Makefile.in index 3a894429b06..446fbb752be 100644 --- a/browser/base/Makefile.in +++ b/browser/base/Makefile.in @@ -57,7 +57,6 @@ EXTRA_JS_MODULES = \ content/openLocationLastURL.jsm \ content/NetworkPrioritizer.jsm \ content/domplate.jsm \ - content/stylePanel.jsm \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 33ec72720d8..290ae4257a0 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -250,26 +250,6 @@ accesskey="&inspectButton.accesskey;" class="toolbarbutton-text" command="Inspector:Inspect"/> - - - - @@ -277,21 +257,6 @@ - - diff --git a/browser/base/content/inspector.js b/browser/base/content/inspector.js index 7fe792ae67e..6bd37f0b671 100644 --- a/browser/base/content/inspector.js +++ b/browser/base/content/inspector.js @@ -366,37 +366,6 @@ var InspectorUI = { } }, - /** - * Toggle the style panel. Invoked from the toolbar's Style button. - */ - toggleStylePanel: function IUI_toggleStylePanel() - { - if (this.isStylePanelOpen) { - this.stylePanel.hidePopup(); - } else { - this.openStylePanel(); - if (this.selection) { - this.updateStylePanel(this.selection); - } - } - }, - - /** - * Toggle the DOM panel. Invoked from the toolbar's DOM button. - */ - toggleDOMPanel: function IUI_toggleDOMPanel() - { - if (this.isDOMPanelOpen) { - this.domPanel.hidePopup(); - } else { - this.clearDOMPanel(); - this.openDOMPanel(); - if (this.selection) { - this.updateDOMPanel(this.selection); - } - } - }, - /** * Is the tree panel open? * @@ -407,26 +376,6 @@ var InspectorUI = { return this.treePanel && this.treePanel.state == "open"; }, - /** - * Is the style panel open? - * - * @returns boolean - */ - get isStylePanelOpen() - { - return this.stylePanel && this.stylePanel.state == "open"; - }, - - /** - * Is the DOM panel open? - * - * @returns boolean - */ - get isDOMPanelOpen() - { - return this.domPanel && this.domPanel.state == "open"; - }, - /** * Return the default selection element for the inspected document. */ @@ -445,10 +394,17 @@ var InspectorUI = { this.ioBox = new InsideOutBox(this, this.treePanelDiv); this.ioBox.createObjectBox(this.win.document.documentElement); this.treeLoaded = true; - if (this.isTreePanelOpen && this.isStylePanelOpen && - this.isDOMPanelOpen && this.treeLoaded) { - this.notifyReady(); - } + + // setup highlighter and start inspecting + this.initializeHighlighter(); + + // Setup the InspectorStore or restore state + this.initializeStore(); + + if (InspectorStore.getValue(this.winID, "inspecting")) + this.startInspecting(); + + this.notifyReady(); }, /** @@ -471,26 +427,40 @@ var InspectorUI = { this.treeIFrame.setAttribute("onclick", "InspectorUI.onTreeClick(event)"); this.treeIFrame = this.treePanel.insertBefore(this.treeIFrame, resizerBox); } - + + this.treePanel.addEventListener("popupshown", function treePanelShown() { + InspectorUI.treePanel.removeEventListener("popupshown", + treePanelShown, false); + + InspectorUI.treeIFrame.addEventListener("load", + function loadedInitializeTreePanel() { + InspectorUI.treeIFrame.removeEventListener("load", + loadedInitializeTreePanel, true); + InspectorUI.initializeTreePanel(); + }, true); + + let src = InspectorUI.treeIFrame.getAttribute("src"); + if (src != "chrome://browser/content/inspector.html") { + InspectorUI.treeIFrame.setAttribute("src", + "chrome://browser/content/inspector.html"); + } else { + InspectorUI.treeIFrame.contentWindow.location.reload(); + } + + }, false); + const panelWidthRatio = 7 / 8; const panelHeightRatio = 1 / 5; - this.treePanel.openPopup(this.browser, "overlap", 80, this.win.innerHeight, + + let width = parseInt(this.win.outerWidth * panelWidthRatio); + let height = parseInt(this.win.outerHeight * panelHeightRatio); + let y = Math.min(window.screen.availHeight - height, this.win.innerHeight); + + this.treePanel.openPopup(this.browser, "overlap", 0, 0, false, false); - this.treePanel.sizeTo(this.win.outerWidth * panelWidthRatio, - this.win.outerHeight * panelHeightRatio); - let src = this.treeIFrame.getAttribute("src"); - if (src != "chrome://browser/content/inspector.html") { - let self = this; - this.treeIFrame.addEventListener("DOMContentLoaded", function() { - self.treeIFrame.removeEventListener("DOMContentLoaded", arguments.callee, true); - self.initializeTreePanel(); - }, true); - - this.treeIFrame.setAttribute("src", "chrome://browser/content/inspector.html"); - } else { - this.initializeTreePanel(); - } + this.treePanel.moveTo(80, y); + this.treePanel.sizeTo(width, height); }, createObjectBox: function IUI_createObjectBox(object, isRoot) @@ -600,55 +570,8 @@ var InspectorUI = { }, /** - * Open the style panel if not already onscreen. - */ - openStylePanel: function IUI_openStylePanel() - { - if (!this.stylePanel) - this.stylePanel = document.getElementById("inspector-style-panel"); - if (!this.isStylePanelOpen) { - this.stylePanel.hidden = false; - // open at top right of browser panel, offset by 20px from top. - this.stylePanel.openPopup(this.browser, "end_before", 0, 20, false, false); - // size panel to 200px wide by half browser height - 60. - this.stylePanel.sizeTo(200, this.win.outerHeight / 2 - 60); - } - }, - - /** - * Open the DOM panel if not already onscreen. - */ - openDOMPanel: function IUI_openDOMPanel() - { - if (!this.isDOMPanelOpen) { - this.domPanel.hidden = false; - // open at middle right of browser panel, offset by 20px from middle. - this.domPanel.openPopup(this.browser, "end_before", 0, - this.win.outerHeight / 2 - 20, false, false); - // size panel to 200px wide by half browser height - 60. - this.domPanel.sizeTo(200, this.win.outerHeight / 2 - 60); - } - }, - - /** - * Toggle the dimmed (semi-transparent) state for a panel by setting or - * removing a dimmed attribute. - * - * @param aDim - * The panel to be dimmed. - */ - toggleDimForPanel: function IUI_toggleDimForPanel(aDim) - { - if (aDim.hasAttribute("dimmed")) { - aDim.removeAttribute("dimmed"); - } else { - aDim.setAttribute("dimmed", "true"); - } - }, - - /** - * Open inspector UI. tree, style and DOM panels if enabled. Add listeners for - * document scrolling, resize, tabContainer.TabSelect and others. + * Open inspector UI. tree. Add listeners for document scrolling, + * resize, tabContainer.TabSelect and others. */ openInspectorUI: function IUI_openInspectorUI() { @@ -661,44 +584,12 @@ var InspectorUI = { this.domplateUtils.setDOM(window); } - // DOM panel initialization and loading (via PropertyPanel.jsm) - let objectPanelTitle = this.strings. - GetStringFromName("object.objectPanelTitle"); - let parent = document.getElementById("inspector-style-panel").parentNode; - this.propertyPanel = new (this.PropertyPanel)(parent, document, - objectPanelTitle, {}); - - // additional DOM panel setup needed for unittest identification and use - this.domPanel = this.propertyPanel.panel; - this.domPanel.setAttribute("id", "inspector-dom-panel"); - this.domBox = this.propertyPanel.tree; - this.domTreeView = this.propertyPanel.treeView; - // open inspector UI this.openTreePanel(); - // style panel setup and activation - this.styleBox = document.getElementById("inspector-style-listbox"); - this.clearStylePanel(); - this.openStylePanel(); - - // DOM panel setup and activation - this.clearDOMPanel(); - this.openDOMPanel(); - - // setup highlighter and start inspecting - this.initializeHighlighter(); - - // Setup the InspectorStore or restore state - this.initializeStore(); - - if (InspectorStore.getValue(this.winID, "inspecting")) - this.startInspecting(); - this.win.document.addEventListener("scroll", this, false); this.win.addEventListener("resize", this, false); this.inspectCmd.setAttribute("checked", true); - document.addEventListener("popupshown", this, false); }, /** @@ -774,8 +665,6 @@ var InspectorUI = { this.highlighter.unhighlight(); } - if (this.isTreePanelOpen) - this.treePanel.hidePopup(); if (this.treePanelDiv) { this.treePanelDiv.ownerPanel = null; let parent = this.treePanelDiv.parentNode; @@ -795,21 +684,19 @@ var InspectorUI = { delete this.domplateUtils; } - if (this.isStylePanelOpen) { - this.stylePanel.hidePopup(); - } - if (this.domPanel) { - this.domPanel.hidePopup(); - this.domBox = null; - this.domTreeView = null; - } this.inspectCmd.setAttribute("checked", false); this.browser = this.win = null; // null out references to browser and window this.winID = null; this.selection = null; this.treeLoaded = false; - this.closing = false; - Services.obs.notifyObservers(null, "inspector-closed", null); + + this.treePanel.addEventListener("popuphidden", function treePanelHidden() { + InspectorUI.closing = false; + Services.obs.notifyObservers(null, "inspector-closed", null); + }, false); + + this.treePanel.hidePopup(); + delete this.treePanel; }, /** @@ -820,8 +707,6 @@ var InspectorUI = { { this.attachPageListeners(); this.inspecting = true; - this.toggleDimForPanel(this.stylePanel); - this.toggleDimForPanel(this.domPanel); }, /** @@ -834,8 +719,6 @@ var InspectorUI = { return; this.detachPageListeners(); this.inspecting = false; - this.toggleDimForPanel(this.stylePanel); - this.toggleDimForPanel(this.domPanel); if (this.highlighter.node) { this.select(this.highlighter.node, true, true); } @@ -860,148 +743,16 @@ var InspectorUI = { let box = this.ioBox.createObjectBox(this.selection); if (!this.inspecting) { this.highlighter.highlightNode(this.selection); - this.updateStylePanel(this.selection); - this.updateDOMPanel(this.selection); } this.ioBox.select(aNode, true, true, aScroll); } }, - ///////////////////////////////////////////////////////////////////////// - //// Model Creation Methods - - /** - * Add a new item to the style panel listbox. - * - * @param aLabel - * A bit of text to put in the listitem's label attribute. - * @param aType - * The type of item. - * @param content - * Text content or value of the listitem. - */ - addStyleItem: function IUI_addStyleItem(aLabel, aType, aContent) - { - let itemLabelString = this.strings.GetStringFromName("style.styleItemLabel"); - let item = document.createElement("listitem"); - - // Do not localize these strings - let label = aLabel; - item.className = "style-" + aType; - if (aContent) { - label = itemLabelString.replace("#1", aLabel); - label = label.replace("#2", aContent); - } - item.setAttribute("label", label); - - this.styleBox.appendChild(item); - }, - - /** - * Create items for each rule included in the given array. - * - * @param aRules - * an array of rule objects - */ - createStyleRuleItems: function IUI_createStyleRuleItems(aRules) - { - let selectorLabel = this.strings.GetStringFromName("style.selectorLabel"); - - aRules.forEach(function(rule) { - this.addStyleItem(selectorLabel, "selector", rule.id); - rule.properties.forEach(function(property) { - if (property.overridden) - return; // property marked overridden elsewhere - // Do not localize the strings below this line - let important = ""; - if (property.important) - important += " !important"; - this.addStyleItem(property.name, "property", property.value + important); - }, this); - }, this); - }, - - /** - * Create rule items for each section as well as the element's style rules, - * if any. - * - * @param aRules - * Array of rules corresponding to the element's style object. - * @param aSections - * Array of sections encapsulating the inherited rules for selectors - * and elements. - */ - createStyleItems: function IUI_createStyleItems(aRules, aSections) - { - this.createStyleRuleItems(aRules); - let inheritedString = - this.strings.GetStringFromName("style.inheritedFrom"); - aSections.forEach(function(section) { - let sectionTitle = section.element.tagName; - if (section.element.id) - sectionTitle += "#" + section.element.id; - let replacedString = inheritedString.replace("#1", sectionTitle); - this.addStyleItem(replacedString, "section"); - this.createStyleRuleItems(section.rules); - }, this); - }, - - /** - * Remove all items from the Style Panel's listbox. - */ - clearStylePanel: function IUI_clearStylePanel() - { - for (let i = this.styleBox.childElementCount; i >= 0; --i) - this.styleBox.removeItemAt(i); - }, - - /** - * Remove all items from the DOM Panel's listbox. - */ - clearDOMPanel: function IUI_clearStylePanel() - { - this.domTreeView.data = {}; - }, - - /** - * Update the contents of the style panel with styles for the currently - * inspected node. - * - * @param aNode - * The highlighted node to get styles for. - */ - updateStylePanel: function IUI_updateStylePanel(aNode) - { - if (this.inspecting || !this.isStylePanelOpen) { - return; - } - - let rules = [], styleSections = [], usedProperties = {}; - this.style.getInheritedRules(aNode, styleSections, usedProperties); - this.style.getElementRules(aNode, rules, usedProperties); - this.clearStylePanel(); - this.createStyleItems(rules, styleSections); - }, - - /** - * Update the contents of the DOM panel with name/value pairs for the - * currently-inspected node. - */ - updateDOMPanel: function IUI_updateDOMPanel(aNode) - { - if (this.inspecting || !this.isDOMPanelOpen) { - return; - } - - this.domTreeView.data = aNode; - }, - ///////////////////////////////////////////////////////////////////////// //// Event Handling notifyReady: function IUI_notifyReady() { - document.removeEventListener("popupshowing", this, false); Services.obs.notifyObservers(null, "inspector-opened", null); }, @@ -1018,15 +769,6 @@ var InspectorUI = { let inspectorClosed = false; switch (event.type) { - case "popupshown": - if (event.target.id == "inspector-tree-panel" || - event.target.id == "inspector-style-panel" || - event.target.id == "inspector-dom-panel") - if (this.isTreePanelOpen && this.isStylePanelOpen && - this.isDOMPanelOpen && this.treeLoaded) { - this.notifyReady(); - } - break; case "TabSelect": winID = this.getWindowID(gBrowser.selectedBrowser.contentWindow); if (this.isTreePanelOpen && winID != this.winID) { @@ -1036,13 +778,17 @@ var InspectorUI = { if (winID && InspectorStore.hasID(winID)) { if (inspectorClosed && this.closing) { - Services.obs.addObserver(function () { + Services.obs.addObserver(function reopenInspectorForTab() { + Services.obs.removeObserver(reopenInspectorForTab, + "inspector-closed", false); InspectorUI.openInspectorUI(); }, "inspector-closed", false); } else { this.openInspectorUI(); } - } else if (InspectorStore.isEmpty()) { + } + + if (InspectorStore.isEmpty()) { gBrowser.tabContainer.removeEventListener("TabSelect", this, false); } break; @@ -1151,8 +897,6 @@ var InspectorUI = { this.selectEventsSuppressed = true; this.select(aNode, true, true); this.selectEventsSuppressed = false; - this.updateStylePanel(aNode); - this.updateDOMPanel(aNode); }, /** @@ -1284,6 +1028,25 @@ var InspectorUI = { { Services.console.logStringMessage(msg); }, + + /** + * Debugging function. + * @param msg + * text to show with the stack trace. + */ + _trace: function TRACE(msg) + { + this._log("TRACE: " + msg); + let frame = Components.stack.caller; + while (frame = frame.caller) { + if (frame.language == Ci.nsIProgrammingLanguage.JAVASCRIPT || + frame.language == Ci.nsIProgrammingLanguage.JAVASCRIPT2) { + this._log("filename: " + frame.filename + " lineNumber: " + frame.lineNumber + + " functionName: " + frame.name); + } + } + this._log("END TRACE"); + }, } /** @@ -1420,26 +1183,3 @@ XPCOMUtils.defineLazyGetter(InspectorUI, "inspectCmd", function () { return document.getElementById("Tools:Inspect"); }); -XPCOMUtils.defineLazyGetter(InspectorUI, "strings", function () { - return Services.strings.createBundle("chrome://browser/locale/inspector.properties"); -}); - -XPCOMUtils.defineLazyGetter(InspectorUI, "PropertyTreeView", function () { - var obj = {}; - Cu.import("resource:///modules/PropertyPanel.jsm", obj); - return obj.PropertyTreeView; -}); - -XPCOMUtils.defineLazyGetter(InspectorUI, "PropertyPanel", function () { - var obj = {}; - Cu.import("resource:///modules/PropertyPanel.jsm", obj); - return obj.PropertyPanel; -}); - -XPCOMUtils.defineLazyGetter(InspectorUI, "style", function () { - var obj = {}; - Cu.import("resource:///modules/stylePanel.jsm", obj); - obj.style.initialize(); - return obj.style; -}); - diff --git a/browser/base/content/stylePanel.jsm b/browser/base/content/stylePanel.jsm deleted file mode 100644 index 21d8ceb1a1d..00000000000 --- a/browser/base/content/stylePanel.jsm +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Copyright (c) 2007, Parakey Inc. - * All rights reserved. - * - * Redistribution and use of this software in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above - * copyright notice, this list of conditions and the - * following disclaimer. - * - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * * Neither the name of Parakey Inc. nor the names of its - * contributors may be used to endorse or promote products - * derived from this software without specific prior - * written permission of Parakey Inc. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Creator: - * Joe Hewitt - * Contributors - * John J. Barton (IBM Almaden) - * Jan Odvarko (Mozilla Corp.) - * Max Stepanov (Aptana Inc.) - * Rob Campbell (Mozilla Corp.) - * Hans Hillen (Paciello Group, Mozilla) - * Curtis Bartley (Mozilla Corp.) - * Mike Collins (IBM Almaden) - * Kevin Decker - * Mike Ratcliffe (Comartis AG) - * Hernan Rodríguez Colmeiro - * Austin Andrews - * Christoph Dorn - * Steven Roussey (AppCenter Inc, Network54) - */ - -var EXPORTED_SYMBOLS = ["style"]; - -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; - -Cu.import("resource://gre/modules/Services.jsm"); - -var style = { - - /** - * initialize domUtils - */ - initialize: function CSS_initialize() - { - this.domUtils = Cc["@mozilla.org/inspector/dom-utils;1"]. - getService(Ci["inIDOMUtils"]); - }, - - /** - * Is the given property sheet a system (user agent) stylesheet? - * - * @param aSheet - * a stylesheet - */ - isSystemStyleSheet: function CSS_isSystemStyleSheet(aSheet) - { - if (!aSheet) - return true; - - let url = aSheet.href; - - if (!url) - return false; - if (url.length == 0) - return true; - if (url[0] == 'h') - return false; - if (url.substr(0, 9) == "resource:") - return true; - if (url.substr(0, 7) == "chrome:") - return true; - if (url == "XPCSafeJSObjectWrapper.cpp") - return true; - if (url.substr(0, 6) == "about:") - return true; - - return false; - }, - - /** - * Parse properties from a given style object. - * Borrowed from Firebug's css.js. - * - * @param aStyle - * a style object - */ - parseCSSProperties: function CSS_parseCSSProps(aStyle) - { - let properties = []; - let lines = aStyle.cssText.match(/(?:[^;\(]*(?:\([^\)]*?\))?[^;\(]*)*;?/g); - let propRE = /\s*([^:\s]*)\s*:\s*(.*?)\s*(! important)?;?$/; - let line, i = 0; - while(line = lines[i++]) { - let match = propRE.exec(line); - if (!match) - continue; - let name = match[1]; - let value = match[2]; - let important = !!match[3]; // true if match[3] is non-empty - properties.unshift({name: name, value: value, important: important}); - } - - return properties; - }, - - /** - * Mark properties overridden further up the hierarchy. - * - * @param aProps - * Array of properties. - * @param aUsedProps - * Object of arrays keyed by property name. - * @param aInherit - * Boolean of whether or not we are in inherited mode. - */ - markOverriddenProperties: function CSS_markOverriddenProperties(aProps, aUsedProps, aInherit) - { - for (let i = 0; i < aProps.length; ++i) { - let prop = aProps[i]; - if (aUsedProps.hasOwnProperty(prop.name)) { - // all previous occurrences of this property - let deadProps = aUsedProps[prop.name]; - for (let j = 0; j < deadProps.length; ++j) { - let deadProp = deadProps[j]; - if (!deadProp.disabled && !deadProp.wasInherited && - deadProp.important && !prop.important) { - prop.overridden = true; // new occurrence overridden - } else if (!prop.disabled) { - deadProp.overridden = true; // previous occurrences overridden - } else { - aUsedProps[prop.name] = []; - } - - prop.wasInherited = aInherit ? true : false; - // all occurrences of a property seen so far, by name - aUsedProps[prop.name].push(prop); - } - } - } - }, - - /** - * Sort given properties in lexical order by name. - * - * @param properties - * An array of properties. - * @returns sorted array. - */ - sortProperties: function CSS_sortProperties(properties) - { - properties.sort(function(a, b) - { - if (a.name < b.name) { - return -1; - } - if (a.name > b.name) { - return 1; - } - return 0; - }); - }, - - /** - * Get properties for a given element and push them to the rules array. - * - * @param aNode - * a DOM node - * @param rules - * An array of rules to add properties to. - * @param usedProps - * Object of arrays keyed by property name. - * @param inherit - * boolean determining whether or not we're in inherit mode - */ - getStyleProperties: function CSS_getStyleProperties(aNode, aRules, aUsedProps, aInherit) - { - let properties = this.parseCSSProperties(aNode.style, aInherit); - - this.sortProperties(properties); - this.markOverriddenProperties(properties, aUsedProps, aInherit); - - if (properties.length) { - aRules.push({rule: aNode, selector: "element.style", - properties: properties, inherited: aInherit}); - } - }, - - /** - * Get properties for a given rule. - * - * @param aRule - * A Rule from a stylesheet. - */ - getRuleProperties: function CSS_getRuleProperties(aRule) - { - let style = aRule.style; - return this.parseCSSProperties(style); - }, - - /** - * Recursively get rules for an element's parents and add them to the - * sections array. - * - * @param aNode - * an element in a DOM tree. - * @param sections - * an array of sections - * @param usedProps - * Object of arrays keyed by property name. - */ - getInheritedRules: function CSS_getInheritedRules(aNode, aSections, aUsedProps) - { - let parent = aNode.parentNode; - if (parent && parent.nodeType == 1) { - this.getInheritedRules(parent, aSections, aUsedProps); - - let rules = []; - this.getElementRules(parent, rules, aUsedProps, true); - - if (rules.length) { - aSections.unshift({element: parent, rules: rules}); - } - } - }, - - /** - * Get the CSS style rules for a given node in the DOM and append them to the - * rules array. - * - * @param aNode - * an element in the DOM tree. - * @param aRules - * an array of rules. - * @param aUsedProps - * Object of arrays keyed by property name. - * @param aInherit - * boolean indicating whether we are in an inherited mode or not - */ - getElementRules: function CSS_getElementRules(aNode, aRules, aUsedProps, aInherit) - { - let inspectedRules; - - try { - inspectedRules = this.domUtils.getCSSStyleRules(aNode); - } catch (ex) { - Services.console.logStringMessage(ex); - } - - if (!inspectedRules) - return; - - for (let i = 0; i < inspectedRules.Count(); ++i) { - let rule = inspectedRules.GetElementAt(i); - let href = rule.parentStyleSheet.href; - - if (!href) { - // Null href means inline style. - href = aNode.ownerDocument.location.href; - } - - let isSystemSheet = this.isSystemStyleSheet(rule.parentStyleSheet); - - if (isSystemSheet) - continue; - - let properties = this.getRuleProperties(rule, aInherit); - if (aInherit && !properties.length) - continue; - - let line = this.domUtils.getRuleLine(rule); - let ruleId = rule.selectorText + " " + href + " (" + line + ")"; - - let sourceLink = "view-source:" + href + "#" + line; - - this.markOverriddenProperties(properties, aUsedProps, aInherit); - - aRules.unshift( - {rule: rule, - id: ruleId, - selector: rule.selectorText, - properties: properties, - inherited: aInherit, - sourceLink: sourceLink, - isSystemSheet: isSystemSheet}); - } - - if (aNode.style) { - this.getStyleProperties(aNode, aRules, aUsedProps, aInherit); - } - }, -}; - diff --git a/browser/base/content/test/Makefile.in b/browser/base/content/test/Makefile.in index 684c2167caa..f8456f4be9a 100644 --- a/browser/base/content/test/Makefile.in +++ b/browser/base/content/test/Makefile.in @@ -184,8 +184,6 @@ _BROWSER_FILES = \ browser_inspector_initialization.js \ browser_inspector_treeSelection.js \ browser_inspector_highlighter.js \ - browser_inspector_stylePanel.js \ - browser_inspector_domPanel.js \ browser_inspector_iframeTest.js \ browser_inspector_scrolling.js \ browser_inspector_store.js \ diff --git a/browser/base/content/test/browser_inspector_domPanel.js b/browser/base/content/test/browser_inspector_domPanel.js deleted file mode 100644 index 4d3f80fcd7c..00000000000 --- a/browser/base/content/test/browser_inspector_domPanel.js +++ /dev/null @@ -1,171 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Inspector DOM Panel Tests. - * - * The Initial Developer of the Original Code is - * The Mozilla Foundation. - * Portions created by the Initial Developer are Copyright (C) 2010 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Rob Campbell - * Mihai Șucan - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -let doc; -let testGen; -let newProperty; - -function createDocument() -{ - doc.body.innerHTML = '
\n' + - '

Some header text

\n' + - '

hi.

\n' + - '

I am a test-case. This text exists ' + - 'solely to provide some things to ' + - 'highlight and count ' + - 'DOM list-items in the box at right. If you are reading this, ' + - 'you should go do something else instead. Maybe read a book. Or better ' + - 'yet, write some test-cases for another bit of code. ' + - 'Maybe more inspector test-cases!

\n' + - '

end transmission

\n' + - '
'; - doc.title = "Inspector DOM Test"; - Services.obs.addObserver(runDOMTests, "inspector-opened", false); - InspectorUI.openInspectorUI(); -} - -function nodeGenerator() -{ - let body = doc.body; - newProperty = "rand" + Date.now(); - body[newProperty] = Math.round(Math.random() * 100); - InspectorUI.inspectNode(body); - yield; - - let h1 = doc.querySelector("h1"); - newProperty = "rand2" + Date.now(); - h1[newProperty] = "test" + Math.random(); - InspectorUI.inspectNode(h1); - yield; - - let first = doc.getElementById("first"); - newProperty = "rand3" + Date.now(); - first[newProperty] = null; - InspectorUI.inspectNode(first); - yield; - - let closing = doc.getElementById("closing"); - newProperty = "bazbaz" + Date.now(); - closing[newProperty] = false; - InspectorUI.inspectNode(closing); - yield; -} - -function runDOMTests() -{ - InspectorUI._log("runDOMtests"); - Services.obs.removeObserver(runDOMTests, "inspector-opened", false); - document.addEventListener("popupshown", performTestComparisons, false); - InspectorUI.stopInspecting(); - testGen = nodeGenerator(); - testGen.next(); -} - -function findInDOMPanel(aString) -{ - let treeView = InspectorUI.domTreeView; - let row; - - for (let i = 0, n = treeView.rowCount; i < n; i++) { - row = treeView.getCellText(i, 0); - if (row && row.indexOf(aString) != -1) { - return true; - } - } - - return false; -} - -function performTestComparisons(evt) -{ - InspectorUI._log("performTestComparisons"); - if (evt.target.id != "highlighter-panel") - return true; - - let selection = InspectorUI.selection; - - ok(selection, "selection"); - ok(InspectorUI.isDOMPanelOpen, "DOM panel is open?"); - ok(InspectorUI.highlighter.isHighlighting, "panel is highlighting"); - - let value = selection[newProperty]; - if (typeof value == "string") { - value = '"' + value + '"'; - } - - ok(findInDOMPanel(newProperty + ': ' + value), - "domPanel shows the correct value for " + newProperty); - - ok(findInDOMPanel('tagName: "' + selection.tagName + '"'), - "domPanel shows the correct tagName"); - - if (selection.id) { - ok(findInDOMPanel('id: "' + selection.id + '"'), - "domPanel shows the correct id"); - } - - try { - testGen.next(); - } catch(StopIteration) { - document.removeEventListener("popupshown", performTestComparisons, false); - finishUp(); - } -} - -function finishUp() { - InspectorUI.closeInspectorUI(); - gBrowser.removeCurrentTab(); - finish(); -} - -function test() -{ - waitForExplicitFinish(); - 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,basic tests for inspector"; -} - diff --git a/browser/base/content/test/browser_inspector_highlighter.js b/browser/base/content/test/browser_inspector_highlighter.js index 82b2cab9fac..fa6bf560eb2 100644 --- a/browser/base/content/test/browser_inspector_highlighter.js +++ b/browser/base/content/test/browser_inspector_highlighter.js @@ -97,11 +97,16 @@ function performTestComparisons(evt) is(h1, InspectorUI.selection, "selection matches node"); ok(InspectorUI.highlighter.isHighlighting, "panel is highlighting"); is(InspectorUI.highlighter.highlitNode, h1, "highlighter matches selection"); - executeSoon(finishUp); + + Services.obs.addObserver(finishUp, "inspector-closed", false); + InspectorUI.closeInspectorUI(); } function finishUp() { - InspectorUI.closeInspectorUI(); + Services.obs.removeObserver(finishUp, "inspector-closed", false); + + ok(!InspectorUI.highlighter.isHighlighting, "panel is not highlighting"); + doc = h1 = null; gBrowser.removeCurrentTab(); finish(); } diff --git a/browser/base/content/test/browser_inspector_initialization.js b/browser/base/content/test/browser_inspector_initialization.js index b56dcba6524..b439c71ccb5 100644 --- a/browser/base/content/test/browser_inspector_initialization.js +++ b/browser/base/content/test/browser_inspector_initialization.js @@ -54,16 +54,12 @@ function runInspectorTests() is(InspectorUI.treeIFrame, iframe, "Inspector IFrame matches"); ok(InspectorUI.inspecting, "Inspector is highlighting"); ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open"); - ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open"); - ok(InspectorUI.isDOMPanelOpen, "Inspector DOM Panel is open"); InspectorUI.closeInspectorUI(); } function finishInspectorTests() { Services.obs.removeObserver(finishInspectorTests, "inspector-closed", false); - ok(!InspectorUI.isDOMPanelOpen, "Inspector DOM Panel is closed"); - ok(!InspectorUI.isStylePanelOpen, "Inspector Style Panel is closed"); ok(!InspectorUI.isTreePanelOpen, "Inspector Tree Panel is closed"); ok(!InspectorUI.inspecting, "Inspector is not highlighting"); gBrowser.removeCurrentTab(); diff --git a/browser/base/content/test/browser_inspector_stylePanel.js b/browser/base/content/test/browser_inspector_stylePanel.js deleted file mode 100644 index d4d2e7d165f..00000000000 --- a/browser/base/content/test/browser_inspector_stylePanel.js +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Inspector Style Panel Tests. - * - * The Initial Developer of the Original Code is - * The Mozilla Foundation. - * Portions created by the Initial Developer are Copyright (C) 2010 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Rob Campbell (original author) - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -let doc; -let spans; -let testGen; - -function createDocument() -{ - doc.body.innerHTML = '
\n' + - '

Some header text

\n' + - '

hi.

\n' + - '

I am a test-case. This text exists ' + - 'solely to provide some things to ' + - 'highlight and count ' + - 'style list-items in the box at right. If you are reading this, ' + - 'you should go do something else instead. Maybe read a book. Or better ' + - 'yet, write some test-cases for another bit of code. ' + - 'Maybe more inspector test-cases!

\n' + - '

end transmission

\n' + - '
'; - doc.title = "Inspector Style Test"; - setupStyleTests(); -} - -function setupStyleTests() -{ - spans = doc.querySelectorAll("span"); - ok(spans, "captain, we have the spans"); - Services.obs.addObserver(runStyleTests, "inspector-opened", false); - InspectorUI.openInspectorUI(); -} - -function spanGenerator() -{ - for (var i = 0; i < spans.length; ++i) { - InspectorUI.inspectNode(spans[i]); - yield; - } -} - -function runStyleTests() -{ - Services.obs.removeObserver(runStyleTests, "inspector-opened", false); - document.addEventListener("popupshown", performTestComparisons, false); - InspectorUI.stopInspecting(); - testGen = spanGenerator(); - testGen.next(); -} - -function performTestComparisons(evt) -{ - if (evt.target.id != "highlighter-panel") - return true; - - ok(InspectorUI.selection, "selection"); - ok(InspectorUI.isStylePanelOpen, "style panel is open?"); - ok(InspectorUI.highlighter.isHighlighting, "panel is highlighting"); - ok(InspectorUI.styleBox.itemCount > 0, "styleBox has items"); - - try { - testGen.next(); - } catch(StopIteration) { - document.removeEventListener("popupshown", performTestComparisons, false); - finishUp(); - } -} - -function finishUp() { - InspectorUI.closeInspectorUI(); - gBrowser.removeCurrentTab(); - finish(); -} - -function test() -{ - waitForExplicitFinish(); - 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,basic tests for inspector"; -} - diff --git a/browser/base/content/test/browser_inspector_tab_switch.js b/browser/base/content/test/browser_inspector_tab_switch.js index 7ec32249d39..d9793a9ae8e 100644 --- a/browser/base/content/test/browser_inspector_tab_switch.js +++ b/browser/base/content/test/browser_inspector_tab_switch.js @@ -60,7 +60,6 @@ function inspectorUIOpen1() // Make sure the inspector is open. ok(InspectorUI.inspecting, "Inspector is highlighting"); ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open"); - ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open"); ok(!InspectorStore.isEmpty(), "InspectorStore is not empty"); is(InspectorStore.length, 1, "InspectorStore.length = 1"); @@ -72,6 +71,7 @@ function inspectorUIOpen1() // Open the second tab. tab2 = gBrowser.addTab(); gBrowser.selectedTab = tab2; + gBrowser.selectedBrowser.addEventListener("load", function(evt) { gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true); @@ -86,12 +86,13 @@ function inspectorTabOpen2() // Make sure the inspector is closed. ok(!InspectorUI.inspecting, "Inspector is not highlighting"); ok(!InspectorUI.isPanelOpen, "Inspector Tree Panel is closed"); - ok(!InspectorUI.isStylePanelOpen, "Inspector Style Panel is closed"); is(InspectorStore.length, 1, "InspectorStore.length = 1"); // Activate the inspector again. + executeSoon(function() { Services.obs.addObserver(inspectorUIOpen2, "inspector-opened", false); - InspectorUI.openInspectorUI(); + InspectorUI.openInspectorUI(); + }); } function inspectorUIOpen2() @@ -101,7 +102,6 @@ function inspectorUIOpen2() // Make sure the inspector is open. ok(InspectorUI.inspecting, "Inspector is highlighting"); ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open"); - ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open"); is(InspectorStore.length, 2, "InspectorStore.length = 2"); // Disable highlighting. @@ -109,8 +109,10 @@ function inspectorUIOpen2() ok(!InspectorUI.inspecting, "Inspector is not highlighting"); // Switch back to tab 1. - Services.obs.addObserver(inspectorFocusTab1, "inspector-opened", false); - gBrowser.selectedTab = tab1; + executeSoon(function() { + Services.obs.addObserver(inspectorFocusTab1, "inspector-opened", false); + gBrowser.selectedTab = tab1; + }); } function inspectorFocusTab1() @@ -120,7 +122,6 @@ function inspectorFocusTab1() // Make sure the inspector is still open. ok(InspectorUI.inspecting, "Inspector is highlighting"); ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open"); - ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open"); is(InspectorStore.length, 2, "InspectorStore.length = 2"); is(InspectorUI.selection, div, "selection matches the div element"); @@ -136,7 +137,6 @@ function inspectorFocusTab2() // Make sure the inspector is still open. ok(!InspectorUI.inspecting, "Inspector is not highlighting"); ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open"); - ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open"); is(InspectorStore.length, 2, "InspectorStore.length = 2"); isnot(InspectorUI.selection, div, "selection does not match the div element"); @@ -154,7 +154,6 @@ function inspectorTabUnload1(evt) // Make sure the Inspector is still open and that the state is correct. ok(!InspectorUI.inspecting, "Inspector is not highlighting"); ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open"); - ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open"); is(InspectorStore.length, 1, "InspectorStore.length = 1"); InspectorUI.closeInspectorUI(); diff --git a/browser/locales/en-US/chrome/browser/browser.dtd b/browser/locales/en-US/chrome/browser/browser.dtd index 7e651d5beb8..5113eb777b0 100644 --- a/browser/locales/en-US/chrome/browser/browser.dtd +++ b/browser/locales/en-US/chrome/browser/browser.dtd @@ -212,19 +212,6 @@ can reach it easily. --> - - - - - - - - - - diff --git a/browser/locales/en-US/chrome/browser/inspector.properties b/browser/locales/en-US/chrome/browser/inspector.properties deleted file mode 100644 index 70225d5efe8..00000000000 --- a/browser/locales/en-US/chrome/browser/inspector.properties +++ /dev/null @@ -1,16 +0,0 @@ -# LOCALIZATION NOTE (style.selectorLabel): Used in the Inspector style panel -# to label a CSS Selector. -style.selectorLabel=Selector - -# LOCALIZATION NOTE (style.inheritedFrom): used in Style panel in -# inspector. Describes which tagname[#id] the properties are inherited from. -style.inheritedFrom=Inherited from: #1 - -# LOCALIZATION NOTE (style.styleItemLabel): used in Style panel in inspector. -# Used for construction of list items, #1 = label, #2 = content. -style.styleItemLabel=#1: #2 - -# LOCALIZATION NOTE (object.objectPanelTitle): used in the Object Panel in the -# Inspector tool. There's also inspectObjectButton in browser.dtd for the -# toolbar button which allows users to open/close the Object panel. -object.objectPanelTitle=Object diff --git a/browser/locales/jar.mn b/browser/locales/jar.mn index 86778bdc0cc..096ba684fa6 100644 --- a/browser/locales/jar.mn +++ b/browser/locales/jar.mn @@ -14,7 +14,6 @@ * locale/browser/browser.dtd (%chrome/browser/browser.dtd) locale/browser/baseMenuOverlay.dtd (%chrome/browser/baseMenuOverlay.dtd) locale/browser/browser.properties (%chrome/browser/browser.properties) - locale/browser/inspector.properties (%chrome/browser/inspector.properties) locale/browser/scratchpad.properties (%chrome/browser/scratchpad.properties) locale/browser/scratchpad.dtd (%chrome/browser/scratchpad.dtd) locale/browser/openLocation.dtd (%chrome/browser/openLocation.dtd) From 5315f31af7a25010ea7cf94563cee5fb57cb3175 Mon Sep 17 00:00:00 2001 From: Panos Astithas Date: Tue, 31 May 2011 10:27:17 +0300 Subject: [PATCH 03/15] Bug 660619 - Silence a warning during tests; r=ddahl,gavin.sharp --- .../console/hudservice/tests/browser/head.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/toolkit/components/console/hudservice/tests/browser/head.js b/toolkit/components/console/hudservice/tests/browser/head.js index 52edee10394..7a761356b25 100644 --- a/toolkit/components/console/hudservice/tests/browser/head.js +++ b/toolkit/components/console/hudservice/tests/browser/head.js @@ -40,19 +40,10 @@ const Cc = Components.classes; const Ci = Components.interfaces; const Cu = Components.utils; +Cu.import("resource://gre/modules/HUDService.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -XPCOMUtils.defineLazyGetter(this, "HUDService", function () { - Cu.import("resource:///modules/HUDService.jsm"); - try { - return HUDService; - } - catch (ex) { - dump(ex + "\n"); - } -}); - function log(aMsg) { dump("*** WebConsoleTest: " + aMsg + "\n"); From 449bd172d1330b74a53856ef3929eb74ad4b1057 Mon Sep 17 00:00:00 2001 From: Panos Astithas Date: Wed, 8 Jun 2011 07:48:40 -0700 Subject: [PATCH 04/15] Bug 659910 - Evaluating console.log or other API messages in Scratchpad presents wrong source link in web console. r=rcampbell,gavin --- toolkit/components/console/hudservice/HUDService.jsm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/toolkit/components/console/hudservice/HUDService.jsm b/toolkit/components/console/hudservice/HUDService.jsm index 7612da8f90f..55841a0296b 100644 --- a/toolkit/components/console/hudservice/HUDService.jsm +++ b/toolkit/components/console/hudservice/HUDService.jsm @@ -5655,6 +5655,13 @@ ConsoleUtils = { // Make the location clickable. locationNode.addEventListener("click", function() { + if (aSourceURL == "Scratchpad") { + let win = Services.wm.getMostRecentWindow("devtools:scratchpad"); + if (win) { + win.focus(); + } + return; + } let viewSourceUtils = aDocument.defaultView.gViewSourceUtils; viewSourceUtils.viewSource(aSourceURL, null, aDocument, aSourceLine); }, true); From fa02e549f929f857bca092c6e5169a35067ac049 Mon Sep 17 00:00:00 2001 From: Dave Townsend Date: Fri, 10 Jun 2011 13:10:48 -0700 Subject: [PATCH 05/15] Bug 655254: When an add-on moves to a different directory but doesn't change in any other way we should keep updated compatibility information. r=robstrong --- toolkit/mozapps/extensions/XPIProvider.jsm | 80 +++++++++++--- .../test/addons/test_bug655254/install.rdf | 19 ++++ .../test/xpcshell/data/test_bug655254.rdf | 26 +++++ .../test/xpcshell/test_bug655254.js | 101 ++++++++++++++++++ .../extensions/test/xpcshell/xpcshell.ini | 1 + 5 files changed, 213 insertions(+), 14 deletions(-) create mode 100644 toolkit/mozapps/extensions/test/addons/test_bug655254/install.rdf create mode 100644 toolkit/mozapps/extensions/test/xpcshell/data/test_bug655254.rdf create mode 100644 toolkit/mozapps/extensions/test/xpcshell/test_bug655254.js diff --git a/toolkit/mozapps/extensions/XPIProvider.jsm b/toolkit/mozapps/extensions/XPIProvider.jsm index ba18e019b43..1d636d8fbc7 100644 --- a/toolkit/mozapps/extensions/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/XPIProvider.jsm @@ -2181,7 +2181,8 @@ var XPIProvider = { * When performing recovery after startup this will be an array of * persistent descriptors of add-ons that are known to be active, * otherwise it will be null - * @return true if a change requiring a restart was detected + * @return a boolean indicating if a change requiring flushing the caches was + * detected */ processFileChanges: function XPI_processFileChanges(aState, aManifests, aUpdateCompatibility, @@ -2205,7 +2206,7 @@ var XPIProvider = { * ran * @param aAddonState * The new state of the add-on - * @return true if restarting the application is required to complete + * @return a boolean indicating if flushing caches is required to complete * changing this add-on */ function updateMetadata(aInstallLocation, aOldAddon, aAddonState) { @@ -2276,6 +2277,37 @@ var XPIProvider = { return false; } + /** + * Updates an add-on's descriptor for when the add-on has moved in the + * filesystem but hasn't changed in any other way. + * + * @param aInstallLocation + * The install location containing the add-on + * @param aOldAddon + * The AddonInternal as it appeared the last time the application + * ran + * @param aAddonState + * The new state of the add-on + * @return a boolean indicating if flushing caches is required to complete + * changing this add-on + */ + function updateDescriptor(aInstallLocation, aOldAddon, aAddonState) { + LOG("Add-on " + aOldAddon.id + " moved to " + aAddonState.descriptor); + + aOldAddon._descriptor = aAddonState.descriptor; + aOldAddon.visible = !(aOldAddon.id in visibleAddons); + + // Update the database + XPIDatabase.setAddonDescriptor(aOldAddon, aAddonState.descriptor); + if (aOldAddon.visible) { + visibleAddons[aOldAddon.id] = aOldAddon; + + return true; + } + + return false; + } + /** * Called when no change has been detected for an add-on's metadata. The * add-on may have become visible due to other add-ons being removed or @@ -2289,8 +2321,8 @@ var XPIProvider = { * ran * @param aAddonState * The new state of the add-on - * @return a boolean indicating if restarting the application is required - * to complete changing this add-on + * @return a boolean indicating if flushing caches is required to complete + * changing this add-on */ function updateVisibilityAndCompatibility(aInstallLocation, aOldAddon, aAddonState) { @@ -2399,8 +2431,8 @@ var XPIProvider = { * @param aOldAddon * The AddonInternal as it appeared the last time the application * ran - * @return a boolean indicating if restarting the application is required - * to complete changing this add-on + * @return a boolean indicating if flushing caches is required to complete + * changing this add-on */ function removeMetadata(aInstallLocation, aOldAddon) { // This add-on has disappeared @@ -2433,8 +2465,8 @@ var XPIProvider = { * @param aMigrateData * If during startup the database had to be upgraded this will * contain data that used to be held about this add-on - * @return a boolean indicating if restarting the application is required - * to complete changing this add-on + * @return a boolean indicating if flushing caches is required to complete + * changing this add-on */ function addMetadata(aInstallLocation, aId, aAddonState, aMigrateData) { LOG("New add-on " + aId + " installed in " + aInstallLocation.name); @@ -2606,17 +2638,19 @@ var XPIProvider = { XPIProvider.inactiveAddonIDs.push(aOldAddon.id); // The add-on has changed if the modification time has changed, or - // the directory it is installed in has changed or we have an - // updated manifest for it. Also reload the metadata for add-ons - // in the application directory when the application version has - // changed + // we have an updated manifest for it. Also reload the metadata for + // add-ons in the application directory when the application version + // has changed if (aOldAddon.id in aManifests[installLocation.name] || aOldAddon.updateDate != addonState.mtime || - aOldAddon._descriptor != addonState.descriptor || (aUpdateCompatibility && installLocation.name == KEY_APP_GLOBAL)) { changed = updateMetadata(installLocation, aOldAddon, addonState) || changed; } + else if (aOldAddon._descriptor != addonState.descriptor) { + changed = updateDescriptor(installLocation, aOldAddon, addonState) || + changed; + } else { changed = updateVisibilityAndCompatibility(installLocation, aOldAddon, addonState) || @@ -3882,6 +3916,8 @@ var XPIDatabase = { "pendingUninstall=:pendingUninstall, " + "applyBackgroundUpdates=:applyBackgroundUpdates WHERE " + "internal_id=:internal_id", + setAddonDescriptor: "UPDATE addon SET descriptor=:descriptor WHERE " + + "internal_id=:internal_id", updateTargetApplications: "UPDATE targetApplication SET " + "minVersion=:minVersion, maxVersion=:maxVersion " + "WHERE addon_internal_id=:internal_id AND id=:id", @@ -5129,7 +5165,23 @@ var XPIDatabase = { }, /** - * Synchronously pdates an add-on's active flag in the database. + * Synchronously sets the file descriptor for an add-on. + * + * @param aAddon + * The DBAddonInternal being updated + * @param aProperties + * A dictionary of properties to set + */ + setAddonDescriptor: function XPIDB_setAddonDescriptor(aAddon, aDescriptor) { + let stmt = this.getStatement("setAddonDescriptor"); + stmt.params.internal_id = aAddon._internal_id; + stmt.params.descriptor = aDescriptor; + + executeStatement(stmt); + }, + + /** + * Synchronously updates an add-on's active flag in the database. * * @param aAddon * The DBAddonInternal to update diff --git a/toolkit/mozapps/extensions/test/addons/test_bug655254/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bug655254/install.rdf new file mode 100644 index 00000000000..2530cce4fff --- /dev/null +++ b/toolkit/mozapps/extensions/test/addons/test_bug655254/install.rdf @@ -0,0 +1,19 @@ + + + + + + addon1@tests.mozilla.org + 1.0 + Test 1 + http://localhost:4444/data/test_bug655254.rdf + + + xpcshell@tests.mozilla.org + 1 + 1 + + + + diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/test_bug655254.rdf b/toolkit/mozapps/extensions/test/xpcshell/data/test_bug655254.rdf new file mode 100644 index 00000000000..9857dcb5555 --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_bug655254.rdf @@ -0,0 +1,26 @@ + + + + + + + + + + 1 + + + xpcshell@tests.mozilla.org + 1 + 2 + + + + + + + + + + diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug655254.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug655254.js new file mode 100644 index 00000000000..7da81be7e12 --- /dev/null +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug655254.js @@ -0,0 +1,101 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +// This verifies that moving an extension in the filesystem without any other +// change still keeps updated compatibility information + +// The test extension uses an insecure update url. +Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false); +// Enable loading extensions from the user and system scopes +Services.prefs.setIntPref("extensions.enabledScopes", + AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_USER); + +createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "1.9.2"); + +do_load_httpd_js(); +var testserver; + +var userDir = gProfD.clone(); +userDir.append("extensions2"); +userDir.append(gAppInfo.ID); + +var dirProvider = { + getFile: function(aProp, aPersistent) { + aPersistent.value = false; + if (aProp == "XREUSysExt") + return userDir.parent; + return null; + }, + + QueryInterface: XPCOMUtils.generateQI([AM_Ci.nsIDirectoryServiceProvider, + AM_Ci.nsISupports]) +}; +Services.dirsvc.registerProvider(dirProvider); + +var addon1 = { + id: "addon1@tests.mozilla.org", + version: "1.0", + name: "Test 1", + updateURL: "http://localhost:4444/data/test_bug655254.rdf", + targetApplications: [{ + id: "xpcshell@tests.mozilla.org", + minVersion: "1", + maxVersion: "1" + }] +}; + +// Set up the profile +function run_test() { + do_test_pending(); + + // Create and configure the HTTP server. + testserver = new nsHttpServer(); + testserver.registerDirectory("/data/", do_get_file("data")); + testserver.start(4444); + + var time = Date.now(); + var dir = writeInstallRDFForExtension(addon1, userDir); + setExtensionModifiedTime(dir, time); + + startupManager(); + + AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) { + do_check_neq(a1, null); + do_check_true(a1.appDisabled); + do_check_false(a1.isActive); + do_check_false(isExtensionInAddonsList(userDir, a1.id)); + + a1.findUpdates({ + onUpdateFinished: function() { + restartManager(); + + AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) { + do_check_neq(a1, null); + do_check_false(a1.appDisabled); + do_check_true(a1.isActive); + do_check_true(isExtensionInAddonsList(userDir, a1.id)); + + shutdownManager(); + + userDir.parent.moveTo(gProfD, "extensions3"); + userDir = gProfD.clone(); + userDir.append("extensions3"); + userDir.append(gAppInfo.ID); + do_check_true(userDir.exists()); + + startupManager(false); + + AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a1) { + do_check_neq(a1, null); + do_check_false(a1.appDisabled); + do_check_true(a1.isActive); + do_check_true(isExtensionInAddonsList(userDir, a1.id)); + + testserver.stop(do_test_finished); + }); + }); + } + }, AddonManager.UPDATE_WHEN_USER_REQUESTED); + }); +} diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini index ec50c8810d6..c2623ef258a 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini @@ -54,6 +54,7 @@ tail = [test_bug616841.js] [test_bug619730.js] [test_bug620837.js] +[test_bug655254.js] [test_cacheflush.js] [test_checkcompatibility.js] [test_corrupt.js] From d6c609999d450230b714baf0844ec66dc87a5476 Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Fri, 10 Jun 2011 17:54:01 -0700 Subject: [PATCH 06/15] Bug 641614 - Fix reordering of localized files in omnijar, r=ted --- build/pgo/profileserver.py | 2 +- client.mk | 2 +- toolkit/locales/l10n.mk | 4 +++- toolkit/mozapps/installer/packager.mk | 7 ++++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/build/pgo/profileserver.py b/build/pgo/profileserver.py index a765de04c56..2542f19ab48 100644 --- a/build/pgo/profileserver.py +++ b/build/pgo/profileserver.py @@ -54,7 +54,7 @@ from automationutils import getDebuggerInfo, addCommonOptions PORT = 8888 PROFILE_DIRECTORY = os.path.abspath(os.path.join(SCRIPT_DIR, "./pgoprofile")) -MOZ_JAR_LOG_DIR = os.path.abspath(os.path.join(os.getenv("OBJDIR"), "jarlog")) +MOZ_JAR_LOG_DIR = os.path.abspath(os.getenv("JARLOG_DIR")) os.chdir(SCRIPT_DIR) class EasyServer(SocketServer.TCPServer): diff --git a/client.mk b/client.mk index 5b7a94fd284..63a63cae46a 100644 --- a/client.mk +++ b/client.mk @@ -211,7 +211,7 @@ endif profiledbuild:: $(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_GENERATE=1 $(MAKE) -C $(PGO_OBJDIR) package - OBJDIR=${PGO_OBJDIR} $(PROFILE_GEN_SCRIPT) + OBJDIR=${PGO_OBJDIR} JARLOG_DIR=${PGO_OBJDIR}/jarlog/en-US $(PROFILE_GEN_SCRIPT) $(MAKE) -f $(TOPSRCDIR)/client.mk maybe_clobber_profiledbuild $(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_USE=1 diff --git a/toolkit/locales/l10n.mk b/toolkit/locales/l10n.mk index f3fd26c8f7e..9338dde4005 100644 --- a/toolkit/locales/l10n.mk +++ b/toolkit/locales/l10n.mk @@ -139,7 +139,9 @@ endif repackage-zip: UNPACKAGE="$(ZIP_IN)" repackage-zip: libs-$(AB_CD) # Adjust jar logs with the new locale (can't use sed -i because of bug 373784) - -$(PERL) -pi.old -e "s/en-US/$(AB_CD)/g" $(JARLOG_DIR)/*.jar.log + mkdir -p $(JARLOG_DIR_AB_CD) + -cp -r $(JARLOG_DIR)/en-US/*.jar.log $(JARLOG_DIR_AB_CD) + -$(PERL) -pi.old -e "s/en-US/$(AB_CD)/g" $(JARLOG_DIR_AB_CD)/*.jar.log # call a hook for apps to put their uninstall helper.exe into the package $(UNINSTALLER_PACKAGE_HOOK) # copy xpi-stage over, but not install.rdf and chrome.manifest, diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk index 1854578a3a6..4af2f6f96f8 100644 --- a/toolkit/mozapps/installer/packager.mk +++ b/toolkit/mozapps/installer/packager.mk @@ -85,6 +85,7 @@ SDK = $(SDK_PATH)$(PKG_BASENAME).sdk$(SDK_SUFFIX) MAKE_PACKAGE = $(error What is a $(MOZ_PKG_FORMAT) package format?); _ABS_DIST = $(call core_abspath,$(DIST)) JARLOG_DIR = $(call core_abspath,$(DEPTH)/jarlog/) +JARLOG_DIR_AB_CD = $(JARLOG_DIR)/$(AB_CD) CREATE_FINAL_TAR = $(TAR) -c --owner=0 --group=0 --numeric-owner \ --mode="go-w" -f @@ -392,11 +393,11 @@ PACK_OMNIJAR = \ mv components.manifest components && \ zip -r9m omni.jar $(OMNIJAR_FILES) -x $(NON_OMNIJAR_FILES) && \ $(GENERATE_CACHE) && \ - $(OPTIMIZE_JARS_CMD) --optimize $(JARLOG_DIR) ./ ./ && \ + $(OPTIMIZE_JARS_CMD) --optimize $(JARLOG_DIR_AB_CD) ./ ./ && \ mv binary.manifest components && \ printf "manifest components/binary.manifest\n" > chrome.manifest UNPACK_OMNIJAR = \ - $(OPTIMIZE_JARS_CMD) --deoptimize $(JARLOG_DIR) ./ ./ && \ + $(OPTIMIZE_JARS_CMD) --deoptimize $(JARLOG_DIR_AB_CD) ./ ./ && \ unzip -o omni.jar && \ rm -f components/binary.manifest && \ sed -e 's/^\#binary-component/binary-component/' components/components.manifest > components.manifest && \ @@ -619,7 +620,7 @@ else endif # DMG endif # MOZ_PKG_MANIFEST endif # UNIVERSAL_BINARY - $(OPTIMIZE_JARS_CMD) --optimize $(JARLOG_DIR) $(DIST)/bin/chrome $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/chrome + $(OPTIMIZE_JARS_CMD) --optimize $(JARLOG_DIR_AB_CD) $(DIST)/bin/chrome $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/chrome ifndef PKG_SKIP_STRIP ifeq ($(OS_ARCH),OS2) @echo "Stripping package directory..." From 8ba236a515ea0060b8c0819aad4aba9a0eb143af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Fri, 10 Jun 2011 11:58:45 +0200 Subject: [PATCH 07/15] remove redundant jsm imports from browser chrome tests --HG-- extra : rebase_source : 3eee5463d514dfe1f62cd59a9c317e31903e7313 --- browser/base/content/test/browser_tabMatchesInAwesomebar.js | 2 -- .../places/tests/browser/browser_markPageAsFollowedLink.js | 2 -- browser/components/preferences/tests/browser_permissions.js | 1 - modules/libpr0n/test/browser/head.js | 6 ------ toolkit/components/console/hudservice/tests/browser/head.js | 6 ------ .../components/places/tests/browser/browser_bug399606.js | 2 -- toolkit/components/places/tests/browser/browser_settitle.js | 2 -- toolkit/components/places/tests/browser/browser_visituri.js | 2 -- .../places/tests/browser/browser_visituri_nohistory.js | 3 --- .../tests/browser/browser_visituri_privatebrowsing.js | 3 --- .../mozapps/extensions/test/browser/browser_bug523784.js | 2 -- toolkit/mozapps/extensions/test/browser/head.js | 1 - toolkit/mozapps/extensions/test/xpinstall/head.js | 1 - 13 files changed, 33 deletions(-) diff --git a/browser/base/content/test/browser_tabMatchesInAwesomebar.js b/browser/base/content/test/browser_tabMatchesInAwesomebar.js index fdfb0a1bfe8..c321dbecf65 100644 --- a/browser/base/content/test/browser_tabMatchesInAwesomebar.js +++ b/browser/base/content/test/browser_tabMatchesInAwesomebar.js @@ -36,8 +36,6 @@ * * ***** END LICENSE BLOCK ***** */ -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); - const TEST_URL_BASES = [ "http://example.org/browser/browser/base/content/test/dummy_page.html#tabmatch", "http://example.org/browser/browser/base/content/test/moz.png#tabmatch" diff --git a/browser/components/places/tests/browser/browser_markPageAsFollowedLink.js b/browser/components/places/tests/browser/browser_markPageAsFollowedLink.js index c9def1d2fcd..035fe75a3af 100644 --- a/browser/components/places/tests/browser/browser_markPageAsFollowedLink.js +++ b/browser/components/places/tests/browser/browser_markPageAsFollowedLink.js @@ -11,8 +11,6 @@ const PAGE_URL = BASE_URL + "/framedPage.html"; const LEFT_URL = BASE_URL + "/frameLeft.html"; const RIGHT_URL = BASE_URL + "/frameRight.html"; -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); - let gTabLoaded = false; let gLeftFrameVisited = false; diff --git a/browser/components/preferences/tests/browser_permissions.js b/browser/components/preferences/tests/browser_permissions.js index f9665aadf0d..e1d201f9f94 100644 --- a/browser/components/preferences/tests/browser_permissions.js +++ b/browser/components/preferences/tests/browser_permissions.js @@ -1,7 +1,6 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/PlacesUtils.jsm"); Components.utils.import("resource://gre/modules/NetUtil.jsm"); diff --git a/modules/libpr0n/test/browser/head.js b/modules/libpr0n/test/browser/head.js index 528495f6e95..ee6efb3dd5d 100644 --- a/modules/libpr0n/test/browser/head.js +++ b/modules/libpr0n/test/browser/head.js @@ -1,7 +1,3 @@ -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; - const RELATIVE_DIR = "modules/libpr0n/test/browser/"; const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR; const TESTROOT2 = "http://example.org/browser/" + RELATIVE_DIR; @@ -9,8 +5,6 @@ const TESTROOT2 = "http://example.org/browser/" + RELATIVE_DIR; var chrome_root = getRootDirectory(gTestPath); const CHROMEROOT = chrome_root; -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); - function getImageLoading(doc, id) { var htmlImg = doc.getElementById(id); return htmlImg.QueryInterface(Ci.nsIImageLoadingContent); diff --git a/toolkit/components/console/hudservice/tests/browser/head.js b/toolkit/components/console/hudservice/tests/browser/head.js index 7a761356b25..a42582af2a4 100644 --- a/toolkit/components/console/hudservice/tests/browser/head.js +++ b/toolkit/components/console/hudservice/tests/browser/head.js @@ -36,13 +36,7 @@ * * ***** END LICENSE BLOCK ***** */ -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; - Cu.import("resource://gre/modules/HUDService.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); function log(aMsg) { diff --git a/toolkit/components/places/tests/browser/browser_bug399606.js b/toolkit/components/places/tests/browser/browser_bug399606.js index 1dcccf7e5c5..7ce5ad6880c 100644 --- a/toolkit/components/places/tests/browser/browser_bug399606.js +++ b/toolkit/components/places/tests/browser/browser_bug399606.js @@ -36,8 +36,6 @@ * * ***** END LICENSE BLOCK ***** */ -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); - gBrowser.selectedTab = gBrowser.addTab(); function test() { diff --git a/toolkit/components/places/tests/browser/browser_settitle.js b/toolkit/components/places/tests/browser/browser_settitle.js index ae38051a732..f8334f8cc10 100644 --- a/toolkit/components/places/tests/browser/browser_settitle.js +++ b/toolkit/components/places/tests/browser/browser_settitle.js @@ -3,8 +3,6 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); - gBrowser.selectedTab = gBrowser.addTab(); function finishAndCleanUp() diff --git a/toolkit/components/places/tests/browser/browser_visituri.js b/toolkit/components/places/tests/browser/browser_visituri.js index 95e8736d63c..91be553b1f1 100644 --- a/toolkit/components/places/tests/browser/browser_visituri.js +++ b/toolkit/components/places/tests/browser/browser_visituri.js @@ -3,8 +3,6 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); - gBrowser.selectedTab = gBrowser.addTab(); function finishAndCleanUp() diff --git a/toolkit/components/places/tests/browser/browser_visituri_nohistory.js b/toolkit/components/places/tests/browser/browser_visituri_nohistory.js index 1f5cd299c01..cf036356251 100644 --- a/toolkit/components/places/tests/browser/browser_visituri_nohistory.js +++ b/toolkit/components/places/tests/browser/browser_visituri_nohistory.js @@ -3,9 +3,6 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); -Components.utils.import("resource://gre/modules/Services.jsm"); - const INITIAL_URL = "http://example.com/tests/toolkit/components/places/tests/browser/begin.html"; const FINAL_URL = "http://example.com/tests/toolkit/components/places/tests/browser/final.html"; diff --git a/toolkit/components/places/tests/browser/browser_visituri_privatebrowsing.js b/toolkit/components/places/tests/browser/browser_visituri_privatebrowsing.js index 79eda7404ce..4dabd49bc6f 100644 --- a/toolkit/components/places/tests/browser/browser_visituri_privatebrowsing.js +++ b/toolkit/components/places/tests/browser/browser_visituri_privatebrowsing.js @@ -3,9 +3,6 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); -Components.utils.import("resource://gre/modules/Services.jsm"); - const INITIAL_URL = "http://example.com/tests/toolkit/components/places/tests/browser/begin.html"; const FINAL_URL = "http://example.com/tests/toolkit/components/places/tests/browser/final.html"; diff --git a/toolkit/mozapps/extensions/test/browser/browser_bug523784.js b/toolkit/mozapps/extensions/test/browser/browser_bug523784.js index f6b1a601b4a..c467e5cc018 100644 --- a/toolkit/mozapps/extensions/test/browser/browser_bug523784.js +++ b/toolkit/mozapps/extensions/test/browser/browser_bug523784.js @@ -3,8 +3,6 @@ const URI_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul"; -Components.utils.import("resource://gre/modules/Services.jsm"); - // This tests that the blocklist dialog still affects soft-blocked add-ons // if the user clicks the "Restart Later" button. It also ensures that the // "Cancel" button is correctly renamed (to "Restart Later"). diff --git a/toolkit/mozapps/extensions/test/browser/head.js b/toolkit/mozapps/extensions/test/browser/head.js index 4c3ab6f9ab3..7d5e2f6d2a2 100644 --- a/toolkit/mozapps/extensions/test/browser/head.js +++ b/toolkit/mozapps/extensions/test/browser/head.js @@ -3,7 +3,6 @@ */ Components.utils.import("resource://gre/modules/AddonManager.jsm"); -Components.utils.import("resource://gre/modules/Services.jsm"); Components.utils.import("resource://gre/modules/NetUtil.jsm"); var pathParts = gTestPath.split("/"); diff --git a/toolkit/mozapps/extensions/test/xpinstall/head.js b/toolkit/mozapps/extensions/test/xpinstall/head.js index 2e8e23784dd..dc8955d317a 100644 --- a/toolkit/mozapps/extensions/test/xpinstall/head.js +++ b/toolkit/mozapps/extensions/test/xpinstall/head.js @@ -27,7 +27,6 @@ function extractChromeRoot(path) { } Components.utils.import("resource://gre/modules/AddonManager.jsm"); -Components.utils.import("resource://gre/modules/Services.jsm"); /** * This is a test harness designed to handle responding to UI during the process From 61711c72fc45102b66f050fb71785b274bf80a3a Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Thu, 9 Jun 2011 14:55:04 -0700 Subject: [PATCH 08/15] Bug 658386 - part 1: eliminate mLastChild field from PtrInfo. r=peterv --HG-- extra : rebase_source : d4b6b71ae273b4b570591d6548cfaed559598d49 --- xpcom/base/nsCycleCollector.cpp | 58 +++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index 864fb3112c5..ea89ce37e33 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -469,9 +469,10 @@ struct PtrInfo PRUint32 mColor : 2; PRUint32 mInternalRefs : 30; PRUint32 mRefCount; - EdgePool::Iterator mFirstChild; // first - EdgePool::Iterator mLastChild; // one after last +private: + EdgePool::Iterator mFirstChild; +public: #ifdef DEBUG_CC size_t mBytes; char *mName; @@ -498,8 +499,7 @@ struct PtrInfo mColor(grey), mInternalRefs(0), mRefCount(0), - mFirstChild(), - mLastChild() + mFirstChild() #ifdef DEBUG_CC , mBytes(0), mName(nsnull), @@ -523,6 +523,28 @@ struct PtrInfo PtrInfo() { NS_NOTREACHED("should never be called"); } + + EdgePool::Iterator FirstChild() + { + return mFirstChild; + } + + // this PtrInfo must be part of a NodePool + EdgePool::Iterator LastChild() + { + return (this + 1)->mFirstChild; + } + + void SetFirstChild(EdgePool::Iterator aFirstChild) + { + mFirstChild = aFirstChild; + } + + // this PtrInfo must be part of a NodePool + void SetLastChild(EdgePool::Iterator aLastChild) + { + (this + 1)->mFirstChild = aLastChild; + } }; /** @@ -542,7 +564,7 @@ private: ~Block() { NS_NOTREACHED("should never be called"); } Block* mNext; - PtrInfo mEntries[BlockSize]; + PtrInfo mEntries[BlockSize + 1]; // +1 to store last child of last node }; public: @@ -1169,7 +1191,8 @@ Fault(const char *msg, PtrInfo *pi) NodePool::Enumerator queue(sCollector->mGraph.mNodes); while (!queue.IsDone()) { PtrInfo *ppi = queue.GetNext(); - for (EdgePool::Iterator e = ppi->mFirstChild, e_end = ppi->mLastChild; + for (EdgePool::Iterator e = ppi->FirstChild(), + e_end = ppi->LastChild(); e != e_end; ++e) { if (*e == pi) { printf(" %p %s\n", ppi->mPointer, ppi->mName); @@ -1264,8 +1287,8 @@ GraphWalker::DoWalk(nsDeque &aQueue) if (mVisitor.ShouldVisitNode(pi)) { mVisitor.VisitNode(pi); - for (EdgePool::Iterator child = pi->mFirstChild, - child_end = pi->mLastChild; + for (EdgePool::Iterator child = pi->FirstChild(), + child_end = pi->LastChild(); child != child_end; ++child) { aQueue.Push(*child); } @@ -1519,14 +1542,15 @@ GCGraphBuilder::Traverse(PtrInfo* aPtrInfo) } #endif - mCurrPi->mFirstChild = mEdgeBuilder.Mark(); - + // this is redundant except at the start of a NodePool block + mCurrPi->SetFirstChild(mEdgeBuilder.Mark()); + nsresult rv = aPtrInfo->mParticipant->Traverse(aPtrInfo->mPointer, *this); if (NS_FAILED(rv)) { Fault("script pointer traversal failed", aPtrInfo); } - mCurrPi->mLastChild = mEdgeBuilder.Mark(); + mCurrPi->SetLastChild(mEdgeBuilder.Mark()); } NS_IMETHODIMP_(void) @@ -3027,8 +3051,8 @@ nsCycleCollector::ExplainLiveExpectedGarbage() PtrInfo *pi = (PtrInfo*)stack.Peek(); if (pi->mSCCIndex == INDEX_UNREACHED) { pi->mSCCIndex = INDEX_TRAVERSING; - for (EdgePool::Iterator child = pi->mFirstChild, - child_end = pi->mLastChild; + for (EdgePool::Iterator child = pi->FirstChild(), + child_end = pi->LastChild(); child != child_end; ++child) { stack.Push(*child); } @@ -3071,8 +3095,8 @@ nsCycleCollector::ExplainLiveExpectedGarbage() PtrInfo *pi = queue.GetNext(); if (pi->mColor != white) continue; - for (EdgePool::Iterator child = pi->mFirstChild, - child_end = pi->mLastChild; + for (EdgePool::Iterator child = pi->FirstChild(), + child_end = pi->LastChild(); child != child_end; ++child) { if ((*child)->mSCCIndex != pi->mSCCIndex) { GraphWalker(SetNonRootGreyVisitor()).Walk(*child); @@ -3134,7 +3158,7 @@ nsCycleCollector::CreateReversedEdges() NodePool::Enumerator countQueue(mGraph.mNodes); while (!countQueue.IsDone()) { PtrInfo *pi = countQueue.GetNext(); - for (EdgePool::Iterator e = pi->mFirstChild, e_end = pi->mLastChild; + for (EdgePool::Iterator e = pi->FirstChild(), e_end = pi->LastChild(); e != e_end; ++e, ++edgeCount) { } } @@ -3152,7 +3176,7 @@ nsCycleCollector::CreateReversedEdges() while (!buildQueue.IsDone()) { PtrInfo *pi = buildQueue.GetNext(); PRInt32 i = 0; - for (EdgePool::Iterator e = pi->mFirstChild, e_end = pi->mLastChild; + for (EdgePool::Iterator e = pi->FirstChild(), e_end = pi->LastChild(); e != e_end; ++e) { current->mTarget = pi; current->mEdgeName = &pi->mEdgeNames[i]; From 9e07c07b802b4106c4cdcb5f1457ba4b3196cc82 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Thu, 9 Jun 2011 14:55:29 -0700 Subject: [PATCH 09/15] Bug 658386 - part 2: eliminate redundant stores of PtrInfo child pointers. r=peterv --HG-- extra : rebase_source : 34b01a7e2a05a7ea35da408a20b5e97f21681af3 --- xpcom/base/nsCycleCollector.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index ea89ce37e33..3e2897b4c3b 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -654,6 +654,11 @@ public: return mNext == mLast; } + PRBool AtBlockEnd() const + { + return mNext == mBlockEnd; + } + PtrInfo* GetNext() { NS_ASSERTION(!IsDone(), "calling GetNext when done"); @@ -1452,6 +1457,7 @@ public: } #endif void Traverse(PtrInfo* aPtrInfo); + void SetLastChild(); // nsCycleCollectionTraversalCallback methods. NS_IMETHOD_(void) NoteXPCOMRoot(nsISupports *root); @@ -1542,14 +1548,17 @@ GCGraphBuilder::Traverse(PtrInfo* aPtrInfo) } #endif - // this is redundant except at the start of a NodePool block mCurrPi->SetFirstChild(mEdgeBuilder.Mark()); nsresult rv = aPtrInfo->mParticipant->Traverse(aPtrInfo->mPointer, *this); if (NS_FAILED(rv)) { Fault("script pointer traversal failed", aPtrInfo); } +} +void +GCGraphBuilder::SetLastChild() +{ mCurrPi->SetLastChild(mEdgeBuilder.Mark()); } @@ -1795,7 +1804,11 @@ nsCycleCollector::MarkRoots(GCGraphBuilder &builder) while (!queue.IsDone()) { PtrInfo *pi = queue.GetNext(); builder.Traverse(pi); + if (queue.AtBlockEnd()) + builder.SetLastChild(); } + if (mGraph.mRootCount > 0) + builder.SetLastChild(); } From c989eae50d0048c9daafb27be66f8542105ef6b1 Mon Sep 17 00:00:00 2001 From: Geoff Lankow Date: Sat, 11 Jun 2011 00:44:53 +1200 Subject: [PATCH 10/15] Bug 662977 - File upload control needs a change event on drop. r=bz --HG-- extra : rebase_source : aa8afe68e9bfcdbbf772a8ed22c93570131a9395 --- layout/forms/nsFileControlFrame.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp index 2aacd49dbd0..7499129c5ca 100644 --- a/layout/forms/nsFileControlFrame.cpp +++ b/layout/forms/nsFileControlFrame.cpp @@ -563,7 +563,12 @@ nsFileControlFrame::BrowseMouseListener::HandleEvent(nsIDOMEvent* aEvent) nsCOMPtr fileList; dataTransfer->GetFiles(getter_AddRefs(fileList)); + + PRBool oldState = mFrame->mTextFrame->GetFireChangeEventState(); + mFrame->mTextFrame->SetFireChangeEventState(PR_TRUE); inputElement->SetFiles(fileList, true); + mFrame->mTextFrame->SetFireChangeEventState(oldState); + mFrame->mTextFrame->CheckFireOnChange(); } return NS_OK; From 9e7756cdd822301c05e4fb13d459416855a64448 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Sat, 11 Jun 2011 09:12:34 +0200 Subject: [PATCH 11/15] Bug 659944 - Remove leftover MOZ_IPC ifdef in nsHttpChannel.cpp; r=cbiesinger --- netwerk/protocol/http/nsHttpChannel.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index c38e21cfca8..3d103ab0c3c 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -45,10 +45,6 @@ * * ***** END LICENSE BLOCK ***** */ -#ifdef MOZ_IPC -#include "base/basictypes.h" -#endif - #include "nsHttpChannel.h" #include "nsHttpHandler.h" #include "nsIApplicationCacheService.h" From b86f9837f4ba89888334b3c965721cab9ae25511 Mon Sep 17 00:00:00 2001 From: Steven Michaud Date: Sat, 11 Jun 2011 09:12:58 +0200 Subject: [PATCH 12/15] Bug 661636 - [10.7 SDK] QuickDraw APIs undefined when doing 32-bit builds using the OS X 10.7 SDK. r=bgirard --- layout/generic/nsObjectFrame.cpp | 44 ++++++++++++++- widget/src/cocoa/nsChildView.h | 46 ++++++++++++++++ widget/src/cocoa/nsChildView.mm | 91 +++++++++++++++++++------------- 3 files changed, 143 insertions(+), 38 deletions(-) diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 831ae4368b9..9293331c306 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -199,8 +199,43 @@ static PRLogModuleInfo *nsObjectFrameLM = PR_NewLogModule("nsObjectFrame"); #endif /* PR_LOGGING */ #if defined(XP_MACOSX) && !defined(NP_NO_CARBON) + #define MAC_CARBON_PLUGINS -#endif + +// The header files QuickdrawAPI.h and QDOffscreen.h are missing on OS X 10.7 +// and up (though the QuickDraw APIs defined in them are still present) -- so +// we need to supply the relevant parts of their contents here. It's likely +// that Apple will eventually remove the APIs themselves (probably in OS X +// 10.8), so we need to make them weak imports, and test for their presence +// before using them. +extern "C" { + #if !defined(__QUICKDRAWAPI__) + extern void SetRect( + Rect * r, + short left, + short top, + short right, + short bottom) + __attribute__((weak_import)); + #endif /* __QUICKDRAWAPI__ */ + + #if !defined(__QDOFFSCREEN__) + extern QDErr NewGWorldFromPtr( + GWorldPtr * offscreenGWorld, + UInt32 PixelFormat, + const Rect * boundsRect, + CTabHandle cTable, /* can be NULL */ + GDHandle aGDevice, /* can be NULL */ + GWorldFlags flags, + Ptr newBuffer, + SInt32 rowBytes) + __attribute__((weak_import)); + extern void DisposeGWorld(GWorldPtr offscreenGWorld) + __attribute__((weak_import)); + #endif /* __QDOFFSCREEN__ */ +} + +#endif /* #if defined(XP_MACOSX) && !defined(NP_NO_CARBON) */ using namespace mozilla; using namespace mozilla::plugins; @@ -1272,6 +1307,13 @@ nsObjectFrame::PrintPlugin(nsRenderingContext& aRenderingContext, // platform specific printing code #ifdef MAC_CARBON_PLUGINS + // Don't use this code if any of the QuickDraw APIs it currently requires + // are missing (as they probably will be on OS X 10.8 and up). + if (!::SetRect || !::NewGWorldFromPtr || !::DisposeGWorld) { + NS_WARNING("Cannot print plugin -- required QuickDraw APIs are missing!"); + return; + } + nsSize contentSize = GetContentRectRelativeToSelf().Size(); window.x = 0; window.y = 0; diff --git a/widget/src/cocoa/nsChildView.h b/widget/src/cocoa/nsChildView.h index a881acd8c01..bb820d322ad 100644 --- a/widget/src/cocoa/nsChildView.h +++ b/widget/src/cocoa/nsChildView.h @@ -66,6 +66,52 @@ #import #import +// The header files QuickdrawAPI.h and QDOffscreen.h are missing on OS X 10.7 +// and up (though the QuickDraw APIs defined in them are still present) -- so +// we need to supply the relevant parts of their contents here. It's likely +// that Apple will eventually remove the APIs themselves (probably in OS X +// 10.8), so we need to make them weak imports, and test for their presence +// before using them. +#ifdef __cplusplus +extern "C" { +#endif + #if !defined(__QUICKDRAWAPI__) + + extern void SetPort(GrafPtr port) + __attribute__((weak_import)); + extern void SetOrigin(short h, short v) + __attribute__((weak_import)); + extern RgnHandle NewRgn(void) + __attribute__((weak_import)); + extern void DisposeRgn(RgnHandle rgn) + __attribute__((weak_import)); + extern void RectRgn(RgnHandle rgn, const Rect * r) + __attribute__((weak_import)); + extern GDHandle GetMainDevice(void) + __attribute__((weak_import)); + extern Boolean IsPortOffscreen(CGrafPtr port) + __attribute__((weak_import)); + extern void SetPortVisibleRegion(CGrafPtr port, RgnHandle visRgn) + __attribute__((weak_import)); + extern void SetPortClipRegion(CGrafPtr port, RgnHandle clipRgn) + __attribute__((weak_import)); + extern CGrafPtr GetQDGlobalsThePort(void) + __attribute__((weak_import)); + + #endif /* __QUICKDRAWAPI__ */ + + #if !defined(__QDOFFSCREEN__) + + extern void GetGWorld(CGrafPtr * port, GDHandle * gdh) + __attribute__((weak_import)); + extern void SetGWorld(CGrafPtr port, GDHandle gdh) + __attribute__((weak_import)); + + #endif /* __QDOFFSCREEN__ */ +#ifdef __cplusplus +} +#endif + class gfxASurface; class nsChildView; class nsCocoaWindow; diff --git a/widget/src/cocoa/nsChildView.mm b/widget/src/cocoa/nsChildView.mm index 76d8a34cca1..4f3d6dd50ba 100644 --- a/widget/src/cocoa/nsChildView.mm +++ b/widget/src/cocoa/nsChildView.mm @@ -1229,44 +1229,54 @@ NS_IMETHODIMP nsChildView::StartDrawPlugin() // visible region to be the entire port every time. It is necessary to set up our // window's port even for CoreGraphics plugins, because they may still use Carbon // internally (see bug #420527 for details). - CGrafPtr port = ::GetWindowPort(WindowRef([window windowRef])); - if (isQDPlugin) { - port = mPluginQDPort.port; - } - - RgnHandle pluginRegion = ::NewRgn(); - if (pluginRegion) { - PRBool portChanged = (port != CGrafPtr(GetQDGlobalsThePort())); - CGrafPtr oldPort; - GDHandle oldDevice; - - if (portChanged) { - ::GetGWorld(&oldPort, &oldDevice); - ::SetGWorld(port, ::IsPortOffscreen(port) ? nsnull : ::GetMainDevice()); + // + // Don't use this code if any of the QuickDraw APIs it currently requires are + // missing (as they probably will be on OS X 10.8 and up). + if (::NewRgn && ::GetQDGlobalsThePort && ::GetGWorld && ::SetGWorld && + ::IsPortOffscreen && ::GetMainDevice && ::SetOrigin && ::RectRgn && + ::SetPortVisibleRegion && ::SetPortClipRegion && ::DisposeRgn) { + CGrafPtr port = ::GetWindowPort(WindowRef([window windowRef])); + if (isQDPlugin) { + port = mPluginQDPort.port; } - ::SetOrigin(0, 0); - - nsIntRect clipRect; // this is in native window coordinates - nsIntPoint origin; - PRBool visible; - GetPluginClipRect(clipRect, origin, visible); - - // XXX if we're not visible, set an empty clip region? - Rect pluginRect; - ConvertGeckoRectToMacRect(clipRect, pluginRect); - - ::RectRgn(pluginRegion, &pluginRect); - ::SetPortVisibleRegion(port, pluginRegion); - ::SetPortClipRegion(port, pluginRegion); - - // now set up the origin for the plugin - ::SetOrigin(origin.x, origin.y); - - ::DisposeRgn(pluginRegion); + RgnHandle pluginRegion = ::NewRgn(); + if (pluginRegion) { + PRBool portChanged = (port != CGrafPtr(::GetQDGlobalsThePort())); + CGrafPtr oldPort; + GDHandle oldDevice; - if (portChanged) - ::SetGWorld(oldPort, oldDevice); + if (portChanged) { + ::GetGWorld(&oldPort, &oldDevice); + ::SetGWorld(port, ::IsPortOffscreen(port) ? nsnull : ::GetMainDevice()); + } + + ::SetOrigin(0, 0); + + nsIntRect clipRect; // this is in native window coordinates + nsIntPoint origin; + PRBool visible; + GetPluginClipRect(clipRect, origin, visible); + + // XXX if we're not visible, set an empty clip region? + Rect pluginRect; + ConvertGeckoRectToMacRect(clipRect, pluginRect); + + ::RectRgn(pluginRegion, &pluginRect); + ::SetPortVisibleRegion(port, pluginRegion); + ::SetPortClipRegion(port, pluginRegion); + + // now set up the origin for the plugin + ::SetOrigin(origin.x, origin.y); + + ::DisposeRgn(pluginRegion); + + if (portChanged) { + ::SetGWorld(oldPort, oldDevice); + } + } + } else { + NS_WARNING("Cannot set plugin's visible region -- required QuickDraw APIs are missing!"); } #endif @@ -2332,7 +2342,11 @@ NSEvent* gLastDragMouseDownEvent = nil; #ifndef NP_NO_QUICKDRAW // This sets the current port to _savePort. // todo: Only do if a Quickdraw plugin is present in the hierarchy! - ::SetPort(NULL); + // Check if ::SetPort() is available -- it probably won't be on + // OS X 10.8 and up. + if (::SetPort) { + ::SetPort(NULL); + } #endif NS_OBJC_END_TRY_ABORT_BLOCK; @@ -2642,7 +2656,10 @@ NSEvent* gLastDragMouseDownEvent = nil; // Set the current GrafPort to a "safe" port before calling [NSQuickDrawView lockFocus], // so that the NSQuickDrawView stashes a pointer to this known-good port internally. // It will set the port back to this port on destruction. - ::SetPort(NULL); // todo: only do if a Quickdraw plugin is present in the hierarchy! + // Check if ::SetPort() is available -- it probably won't be on OS X 10.8 and up. + if (::SetPort) { + ::SetPort(NULL); // todo: only do if a Quickdraw plugin is present in the hierarchy! + } #endif [super lockFocus]; From 05ead9048b27593f983bf1afe21d00b7348b3264 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 11 Jun 2011 09:52:24 +0200 Subject: [PATCH 13/15] Bug 660433 - Remove nsIDOMNSHTMLTextAreaElement; f=volkmar r=peterv --- .../content/src/nsHTMLTextAreaElement.cpp | 9 +-- .../html/content/src/nsTextEditorState.cpp | 8 +- content/xbl/src/nsXBLPrototypeHandler.cpp | 4 +- .../document/src/nsXULCommandDispatcher.cpp | 1 - dom/base/nsDOMClassInfo.cpp | 2 - dom/base/nsWindowRoot.cpp | 4 +- dom/interfaces/html/Makefile.in | 1 - .../html/nsIDOMHTMLTextAreaElement.idl | 42 +++++++++-- .../html/nsIDOMNSHTMLTextAreaElement.idl | 74 ------------------- js/src/xpconnect/src/dom_quickstubs.qsconf | 10 +-- layout/base/nsPresShell.cpp | 1 - layout/forms/nsTextControlFrame.cpp | 2 - 12 files changed, 52 insertions(+), 106 deletions(-) delete mode 100644 dom/interfaces/html/nsIDOMNSHTMLTextAreaElement.idl diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp index 13d07356be8..a7059142796 100644 --- a/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -36,8 +36,8 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ + #include "nsIDOMHTMLTextAreaElement.h" -#include "nsIDOMNSHTMLTextAreaElement.h" #include "nsITextControlElement.h" #include "nsIDOMNSEditableElement.h" #include "nsIControllers.h" @@ -90,7 +90,6 @@ static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID); class nsHTMLTextAreaElement : public nsGenericHTMLFormElement, public nsIDOMHTMLTextAreaElement, - public nsIDOMNSHTMLTextAreaElement, public nsITextControlElement, public nsIDOMNSEditableElement, public nsStubMutationObserver, @@ -117,9 +116,6 @@ public: // nsIDOMHTMLTextAreaElement NS_DECL_NSIDOMHTMLTEXTAREAELEMENT - // nsIDOMNSHTMLTextAreaElement - NS_DECL_NSIDOMNSHTMLTEXTAREAELEMENT - // nsIDOMNSEditableElement NS_IMETHOD GetEditor(nsIEditor** aEditor) { @@ -352,9 +348,8 @@ DOMCI_NODE_DATA(HTMLTextAreaElement, nsHTMLTextAreaElement) // QueryInterface implementation for nsHTMLTextAreaElement NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLTextAreaElement) - NS_HTML_CONTENT_INTERFACE_TABLE6(nsHTMLTextAreaElement, + NS_HTML_CONTENT_INTERFACE_TABLE5(nsHTMLTextAreaElement, nsIDOMHTMLTextAreaElement, - nsIDOMNSHTMLTextAreaElement, nsITextControlElement, nsIDOMNSEditableElement, nsIMutationObserver, diff --git a/content/html/content/src/nsTextEditorState.cpp b/content/html/content/src/nsTextEditorState.cpp index 75440592411..aa282933fc9 100644 --- a/content/html/content/src/nsTextEditorState.cpp +++ b/content/html/content/src/nsTextEditorState.cpp @@ -49,7 +49,7 @@ #include "nsTextControlFrame.h" #include "nsIControllers.h" #include "nsIDOMHTMLInputElement.h" -#include "nsIDOMNSHTMLTextAreaElement.h" +#include "nsIDOMHTMLTextAreaElement.h" #include "nsITransactionManager.h" #include "nsIControllerContext.h" #include "nsAttrValue.h" @@ -782,7 +782,7 @@ DoCommandCallback(const char *aCommand, void *aData) if (input) { input->GetControllers(getter_AddRefs(controllers)); } else { - nsCOMPtr textArea = + nsCOMPtr textArea = do_QueryInterface(content); if (textArea) { @@ -1249,7 +1249,7 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue) if (inputElement) { rv = inputElement->GetControllers(getter_AddRefs(controllers)); } else { - nsCOMPtr textAreaElement = + nsCOMPtr textAreaElement = do_QueryInterface(mTextCtrlElement); if (!textAreaElement) @@ -1460,7 +1460,7 @@ nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame) inputElement->GetControllers(getter_AddRefs(controllers)); else { - nsCOMPtr textAreaElement = + nsCOMPtr textAreaElement = do_QueryInterface(mTextCtrlElement); if (textAreaElement) { textAreaElement->GetControllers(getter_AddRefs(controllers)); diff --git a/content/xbl/src/nsXBLPrototypeHandler.cpp b/content/xbl/src/nsXBLPrototypeHandler.cpp index b4b8f3aceee..2ea2f0b5f9a 100644 --- a/content/xbl/src/nsXBLPrototypeHandler.cpp +++ b/content/xbl/src/nsXBLPrototypeHandler.cpp @@ -54,7 +54,7 @@ #include "nsIDOMXULElement.h" #include "nsIDOMNSUIEvent.h" #include "nsIURI.h" -#include "nsIDOMNSHTMLTextAreaElement.h" +#include "nsIDOMHTMLTextAreaElement.h" #include "nsIDOMHTMLInputElement.h" #include "nsIDOMText.h" #include "nsFocusManager.h" @@ -558,7 +558,7 @@ nsXBLPrototypeHandler::GetController(nsPIDOMEventTarget* aTarget) xulElement->GetControllers(getter_AddRefs(controllers)); if (!controllers) { - nsCOMPtr htmlTextArea(do_QueryInterface(aTarget)); + nsCOMPtr htmlTextArea(do_QueryInterface(aTarget)); if (htmlTextArea) htmlTextArea->GetControllers(getter_AddRefs(controllers)); } diff --git a/content/xul/document/src/nsXULCommandDispatcher.cpp b/content/xul/document/src/nsXULCommandDispatcher.cpp index 7d874489db5..f2c7d2cc52c 100644 --- a/content/xul/document/src/nsXULCommandDispatcher.cpp +++ b/content/xul/document/src/nsXULCommandDispatcher.cpp @@ -50,7 +50,6 @@ #include "nsIDOMXULDocument.h" #include "nsIDOMHTMLDocument.h" #include "nsIDOMElement.h" -#include "nsIDOMNSHTMLTextAreaElement.h" #include "nsIDOMWindowInternal.h" #include "nsIDOMXULElement.h" #include "nsIDocument.h" diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 6ea9cff40a1..91330d679dc 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -308,7 +308,6 @@ #include "nsIDOMHTMLTableRowElement.h" #include "nsIDOMHTMLTableSectionElem.h" #include "nsIDOMHTMLTextAreaElement.h" -#include "nsIDOMNSHTMLTextAreaElement.h" #include "nsIDOMHTMLTitleElement.h" #include "nsIDOMHTMLUListElement.h" #include "nsIDOMHTMLUnknownElement.h" @@ -2936,7 +2935,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(HTMLTextAreaElement, nsIDOMHTMLTextAreaElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLTextAreaElement) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLTextAreaElement) DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES DOM_CLASSINFO_MAP_END diff --git a/dom/base/nsWindowRoot.cpp b/dom/base/nsWindowRoot.cpp index 19f5bbe7738..01ca00228a6 100644 --- a/dom/base/nsWindowRoot.cpp +++ b/dom/base/nsWindowRoot.cpp @@ -56,7 +56,7 @@ #include "nsGlobalWindow.h" #include "nsFocusManager.h" #include "nsIDOMHTMLInputElement.h" -#include "nsIDOMNSHTMLTextAreaElement.h" +#include "nsIDOMHTMLTextAreaElement.h" #include "nsIControllers.h" #include "nsCycleCollectionParticipant.h" @@ -286,7 +286,7 @@ nsWindowRoot::GetControllers(nsIControllers** aResult) return xulElement->GetControllers(aResult); #endif - nsCOMPtr htmlTextArea = + nsCOMPtr htmlTextArea = do_QueryInterface(focusedContent); if (htmlTextArea) return htmlTextArea->GetControllers(aResult); diff --git a/dom/interfaces/html/Makefile.in b/dom/interfaces/html/Makefile.in index b0e680a0957..ffe7db48196 100644 --- a/dom/interfaces/html/Makefile.in +++ b/dom/interfaces/html/Makefile.in @@ -123,7 +123,6 @@ XPIDLSRCS = \ nsIDOMNSHTMLElement.idl \ nsIDOMNSHTMLFrameElement.idl \ nsIDOMNSHTMLOptionCollectn.idl \ - nsIDOMNSHTMLTextAreaElement.idl \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl b/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl index 54adad77ca1..3fe0ec481b3 100644 --- a/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl @@ -39,6 +39,9 @@ #include "nsIDOMHTMLElement.idl" +interface nsIControllers; +interface nsIDOMValidityState; + /** * The nsIDOMHTMLTextAreaElement interface is the interface to a * [X]HTML textarea element. @@ -53,16 +56,45 @@ [scriptable, uuid(905edd3e-c0b3-4d54-8a2c-0eaab6ccb3cf)] interface nsIDOMHTMLTextAreaElement : nsIDOMHTMLElement { - // Modified in DOM Level 2: - attribute DOMString defaultValue; - readonly attribute nsIDOMHTMLFormElement form; + attribute boolean autofocus; attribute unsigned long cols; attribute boolean disabled; + readonly attribute nsIDOMHTMLFormElement form; + attribute long maxLength; attribute DOMString name; + attribute DOMString placeholder; attribute boolean readOnly; + attribute boolean required; attribute unsigned long rows; - attribute long tabIndex; + /** + * Reflects the wrap content attribute. Possible values are "soft", "hard" and + * "off". "soft" is the default. + */ + [Null(Stringify)] + attribute DOMString wrap; + readonly attribute DOMString type; + attribute DOMString defaultValue; attribute DOMString value; - void select(); + readonly attribute long textLength; + + // The following lines are part of the constraint validation API, see: + // http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api + readonly attribute boolean willValidate; + readonly attribute nsIDOMValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in DOMString error); + + void select(); + attribute long selectionStart; + attribute long selectionEnd; + void setSelectionRange(in long selectionStart, in long selectionEnd); + + // Defined on HTMLElement in the specification. + attribute long tabIndex; + + + // Mozilla extensions + readonly attribute nsIControllers controllers; }; diff --git a/dom/interfaces/html/nsIDOMNSHTMLTextAreaElement.idl b/dom/interfaces/html/nsIDOMNSHTMLTextAreaElement.idl deleted file mode 100644 index 5d47c7323cc..00000000000 --- a/dom/interfaces/html/nsIDOMNSHTMLTextAreaElement.idl +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Vidur Apparao (original author) - * Johnny Stenback - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "domstubs.idl" - -interface nsIControllers; -interface nsIDOMValidityState; - -[scriptable, uuid(df5dc23d-cf90-443e-bf56-cd3af021ebc7)] -interface nsIDOMNSHTMLTextAreaElement : nsISupports -{ - attribute boolean autofocus; - readonly attribute nsIControllers controllers; - - readonly attribute long textLength; - attribute long selectionStart; - attribute long selectionEnd; - attribute long maxLength; - attribute DOMString placeholder; - attribute boolean required; - - /** - * Reflects the wrap content attribute. Possible values are "soft, "hard" and - * "off". "soft" is the default. - */ - [Null(Stringify)] attribute DOMString wrap; - - // The following lines are parte of the constraint validation API, see: - // http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api - readonly attribute boolean willValidate; - readonly attribute nsIDOMValidityState validity; - readonly attribute DOMString validationMessage; - boolean checkValidity(); - void setCustomValidity(in DOMString error); - - void setSelectionRange(in long selectionStart, - in long selectionEnd); -}; diff --git a/js/src/xpconnect/src/dom_quickstubs.qsconf b/js/src/xpconnect/src/dom_quickstubs.qsconf index d13c8d877de..a83c004b704 100644 --- a/js/src/xpconnect/src/dom_quickstubs.qsconf +++ b/js/src/xpconnect/src/dom_quickstubs.qsconf @@ -333,6 +333,11 @@ members = [ 'nsIDOMHTMLTextAreaElement.value', 'nsIDOMHTMLTextAreaElement.type', 'nsIDOMHTMLTextAreaElement.select', + 'nsIDOMHTMLTextAreaElement.setSelectionRange', + 'nsIDOMHTMLTextAreaElement.selectionStart', + 'nsIDOMHTMLTextAreaElement.selectionEnd', + 'nsIDOMHTMLTextAreaElement.textLength', + 'nsIDOMHTMLTextAreaElement.wrap', 'nsIDOMHTMLTitleElement.text', 'nsIDOMHTMLCanvasElement.width', 'nsIDOMHTMLCanvasElement.height', @@ -350,11 +355,6 @@ members = [ 'nsIDOMNSHTMLFrameElement.contentWindow', 'nsIDOMNSHTMLOptionCollection.selectedIndex', 'nsIDOMNSHTMLOptionCollection.add', - 'nsIDOMNSHTMLTextAreaElement.setSelectionRange', - 'nsIDOMNSHTMLTextAreaElement.selectionStart', - 'nsIDOMNSHTMLTextAreaElement.selectionEnd', - 'nsIDOMNSHTMLTextAreaElement.textLength', - 'nsIDOMNSHTMLTextAreaElement.wrap', # dom/interfaces/json - None. # All 4 methods of nsIJSON call GetCurrentNativeCallContext. diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 142f670ba46..c4105df1256 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -113,7 +113,6 @@ #include "nsIParser.h" #include "nsParserCIID.h" #include "nsFrameSelection.h" -#include "nsIDOMNSHTMLTextAreaElement.h" #include "nsViewsCID.h" #include "nsPresArena.h" #include "nsFrameManager.h" diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp index ae4207f43b4..5589bbafbd5 100644 --- a/layout/forms/nsTextControlFrame.cpp +++ b/layout/forms/nsTextControlFrame.cpp @@ -36,11 +36,9 @@ * * ***** END LICENSE BLOCK ***** */ - #include "nsCOMPtr.h" #include "nsTextControlFrame.h" #include "nsIDocument.h" -#include "nsIDOMNSHTMLTextAreaElement.h" #include "nsIFormControl.h" #include "nsIServiceManager.h" #include "nsFrameSelection.h" From c38d0435c85ba1f8bb0b5f097d7d2a34ee274b9b Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 11 Jun 2011 09:52:27 +0200 Subject: [PATCH 14/15] Bug 663194 - Calling drawImage with zero-size canvas should throw INVALID_STATE_ERR; r=sicking --- .../canvas/src/nsCanvasRenderingContext2D.cpp | 12 +++- content/canvas/test/Makefile.in | 1 + .../test/test_2d.drawImage.zerocanvas.html | 56 +++++++++++++++++++ .../html/content/public/nsHTMLCanvasElement.h | 7 +++ 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 content/canvas/test/test_2d.drawImage.zerocanvas.html diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index fa0127ddd40..47b62fed6f8 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -3291,8 +3291,14 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1, return NS_ERROR_DOM_TYPE_MISMATCH_ERR; } - double sx,sy,sw,sh; - double dx,dy,dw,dh; + nsCOMPtr content = do_QueryInterface(imgElt); + nsHTMLCanvasElement* canvas = nsHTMLCanvasElement::FromContent(content); + if (canvas) { + nsIntSize size = canvas->GetSize(); + if (size.width == 0 || size.height == 0) { + return NS_ERROR_DOM_INVALID_STATE_ERR; + } + } gfxMatrix matrix; nsRefPtr pattern; @@ -3334,6 +3340,8 @@ nsCanvasRenderingContext2D::DrawImage(nsIDOMElement *imgElt, float a1, } } + double sx,sy,sw,sh; + double dx,dy,dw,dh; if (optional_argc == 0) { dx = a1; dy = a2; diff --git a/content/canvas/test/Makefile.in b/content/canvas/test/Makefile.in index 3d30e9b3d96..e848cfe373f 100644 --- a/content/canvas/test/Makefile.in +++ b/content/canvas/test/Makefile.in @@ -79,6 +79,7 @@ _TEST_FILES_0 = \ test_2d.composite.uncovered.image.destination-in.html \ test_2d.composite.uncovered.image.source-in.html \ test_2d.composite.uncovered.image.source-out.html \ + test_2d.drawImage.zerocanvas.html \ test_toDataURL_lowercase_ascii.html \ test_toDataURL_parameters.html \ test_mozGetAsFile.html \ diff --git a/content/canvas/test/test_2d.drawImage.zerocanvas.html b/content/canvas/test/test_2d.drawImage.zerocanvas.html new file mode 100644 index 00000000000..e085051d7aa --- /dev/null +++ b/content/canvas/test/test_2d.drawImage.zerocanvas.html @@ -0,0 +1,56 @@ + +Canvas test: 2d.drawImage.zerocanvas + + + + +

FAIL (fallback content)

+ + diff --git a/content/html/content/public/nsHTMLCanvasElement.h b/content/html/content/public/nsHTMLCanvasElement.h index 69ac3f6321c..1f624154ae3 100644 --- a/content/html/content/public/nsHTMLCanvasElement.h +++ b/content/html/content/public/nsHTMLCanvasElement.h @@ -68,6 +68,13 @@ public: nsHTMLCanvasElement(already_AddRefed aNodeInfo); virtual ~nsHTMLCanvasElement(); + static nsHTMLCanvasElement* FromContent(nsIContent* aPossibleCanvas) + { + if (!aPossibleCanvas || !aPossibleCanvas->IsHTML(nsGkAtoms::canvas)) { + return nsnull; + } + return static_cast(aPossibleCanvas); + } // nsISupports NS_DECL_ISUPPORTS_INHERITED From 23ad77aa4783225cb50c3c7b96b7632e52d06a05 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sat, 11 Jun 2011 09:57:47 +0200 Subject: [PATCH 15/15] Bug 663190 - Calling strokeRect with zero width or height should do nothing; r=smaug --- content/canvas/src/nsCanvasRenderingContext2D.cpp | 3 +++ content/canvas/test/test_canvas.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index 47b62fed6f8..6ad89d22df9 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -2028,6 +2028,9 @@ nsCanvasRenderingContext2D::FillRect(float x, float y, float w, float h) NS_IMETHODIMP nsCanvasRenderingContext2D::StrokeRect(float x, float y, float w, float h) { + if (w == 0.f && h == 0.f) { + return NS_OK; + } return DrawRect(gfxRect(x, y, w, h), STYLE_STROKE); } diff --git a/content/canvas/test/test_canvas.html b/content/canvas/test/test_canvas.html index 4702e4cca06..1bccbcdac8d 100644 --- a/content/canvas/test/test_canvas.html +++ b/content/canvas/test/test_canvas.html @@ -18395,7 +18395,7 @@ ctx.lineWidth = 250; ctx.lineCap = 'round'; ctx.lineJoin = 'round'; ctx.strokeRect(50, 25, 0, 0); -todo_isPixel(ctx, 50,25, 0,0,0,0, 0); +isPixel(ctx, 50,25, 0,0,0,0, 0); }