deleted file mode 100644
--- a/inspector-actorid-detail.diff
+++ /dev/null
@@ -1,53 +0,0 @@
-# HG changeset patch
-# User Dave Camp <dcamp@mozilla.com>
-# Date 1374619700 25200
-# Tue Jul 23 15:48:20 2013 -0700
-# Node ID a4f0be7874bc6617a254cf4e4176e6c743d3b87d
-# Parent dc3046b986725036725fd2bf6a57e4d62a5ce947
-imported patch inspector-actorid-detail.diff
-
-diff --git a/toolkit/devtools/server/actors/inspector.js b/toolkit/devtools/server/actors/inspector.js
---- a/toolkit/devtools/server/actors/inspector.js
-+++ b/toolkit/devtools/server/actors/inspector.js
-@@ -129,16 +129,20 @@ var NodeActor = protocol.ActorClass({
- /**
- * Instead of storing a connection object, the NodeActor gets its connection
- * from its associated walker.
- */
- get conn() this.walker.conn,
-
- // Returns the JSON representation of this object over the wire.
- form: function(detail) {
-+ if (detail === "actorid") {
-+ return this.actorID;
-+ }
-+
- let parentNode = this.walker.parentNode(this);
-
- // Estimate the number of children.
- let numChildren = this.rawNode.childNodes.length;
- if (numChildren === 0 &&
- (this.rawNode.contentDocument || this.rawNode.getSVGDocument)) {
- // This might be an iframe with virtual children.
- numChildren = 1;
-@@ -299,16 +303,20 @@ let NodeFront = protocol.FrontClass(Node
- this._observer = null;
- }
-
- protocol.Front.prototype.destroy.call(this);
- },
-
- // Update the object given a form representation off the wire.
- form: function(form, detail, ctx) {
-+ if (detail === "actorid") {
-+ this.actorID = form;
-+ return;
-+ }
- // Shallow copy of the form. We could just store a reference, but
- // eventually we'll want to update some of the data.
- this._form = object.merge(form);
- this._form.attrs = this._form.attrs ? this._form.attrs.slice() : [];
-
- if (form.parent) {
- // Get the owner actor for this actor (the walker), and find the
- // parent node of this actor from it, creating a standin node if
deleted file mode 100644
--- a/inspector-namespace-fix.diff
+++ /dev/null
@@ -1,30 +0,0 @@
-# HG changeset patch
-# User Dave Camp <dcamp@mozilla.com>
-# Date 1374619876 25200
-# Tue Jul 23 15:51:16 2013 -0700
-# Node ID 26c89087a26174b5d75d4fe575580cd4362b4eeb
-# Parent 451135201aa048928428f3348b16a78b525b1fb4
-[mq]: inspector-namespace-fix.diff
-
-diff --git a/toolkit/devtools/server/actors/inspector.js b/toolkit/devtools/server/actors/inspector.js
---- a/toolkit/devtools/server/actors/inspector.js
-+++ b/toolkit/devtools/server/actors/inspector.js
-@@ -147,17 +147,17 @@ var NodeActor = protocol.ActorClass({
- // This might be an iframe with virtual children.
- numChildren = 1;
- }
-
- let form = {
- actor: this.actorID,
- parent: parentNode ? parentNode.actorID : undefined,
- nodeType: this.rawNode.nodeType,
-- namespaceURI: this.namespaceURI,
-+ namespaceURI: this.rawNode.namespaceURI,
- nodeName: this.rawNode.nodeName,
- numChildren: numChildren,
-
- // doctype attributes
- name: this.rawNode.name,
- publicId: this.rawNode.publicId,
- systemId: this.rawNode.systemId,
-
deleted file mode 100644
--- a/inspector-retain-root.diff
+++ /dev/null
@@ -1,42 +0,0 @@
-# HG changeset patch
-# Parent 700058ec88949997596af0ba6bc4bedcdced5d9a
-
-diff --git a/toolkit/devtools/server/actors/inspector.js b/toolkit/devtools/server/actors/inspector.js
---- a/toolkit/devtools/server/actors/inspector.js
-+++ b/toolkit/devtools/server/actors/inspector.js
-@@ -709,30 +709,34 @@ var WalkerActor = protocol.ActorClass({
- if (parent) {
- return this._ref(parent);
- }
- return null;
- },
-
- /**
- * Release actors for a node and all child nodes.
-+ * This will not release the root node.
- */
- releaseNode: method(function(node) {
- let walker = documentWalker(node.rawNode);
-
- let child = walker.firstChild();
- while (child) {
- let childActor = this._refMap.get(child);
- if (childActor) {
- this.releaseNode(childActor);
- }
- child = walker.nextSibling();
- }
-
-- node.destroy();
-+ // Refuse to destroy the root node
-+ if (node !== this.rootNode) {
-+ node.destroy();
-+ }
- }, {
- request: { node: Arg(0, "domnode") }
- }),
-
- /**
- * Add any nodes between `node` and the walker's root node that have not
- * yet been seen by the client.
- */
deleted file mode 100644
--- a/move-csslogic.diff
+++ /dev/null
@@ -1,108 +0,0 @@
-# HG changeset patch
-# User Dave Camp <dcamp@mozilla.com>
-# Date 1374688624 25200
-# Wed Jul 24 10:57:04 2013 -0700
-# Node ID dc3046b986725036725fd2bf6a57e4d62a5ce947
-# Parent c057ecd8f9b4e82b7ab7ca6d54d8b752d9c5064d
-imported patch move-csslogic.diff
-
-diff --git a/toolkit/devtools/Loader.jsm b/toolkit/devtools/Loader.jsm
---- a/toolkit/devtools/Loader.jsm
-+++ b/toolkit/devtools/Loader.jsm
-@@ -46,16 +46,17 @@ var BuiltinProvider = {
- "toolkit/loader": loader
- },
- paths: {
- "": "resource://gre/modules/commonjs/",
- "main": "resource:///modules/devtools/main.js",
- "devtools": "resource:///modules/devtools",
- "devtools/server": "resource://gre/modules/devtools/server",
- "devtools/toolkit/webconsole": "resource://gre/modules/devtools/toolkit/webconsole",
-+ "devtools/styleinspector/css-logic": "resource://gre/modules/devtools/styleinspector/css-logic",
-
- // Allow access to xpcshell test items from the loader.
- "xpcshell-test": "resource://test"
- },
- globals: loaderGlobals
- });
-
- return promise.resolve(undefined);
-@@ -80,26 +81,29 @@ var SrcdirProvider = {
- let srcdir = Services.prefs.getComplexValue("devtools.loader.srcdir",
- Ci.nsISupportsString);
- srcdir = OS.Path.normalize(srcdir.data.trim());
- let devtoolsDir = OS.Path.join(srcdir, "browser", "devtools");
- let devtoolsURI = this.fileURI(devtoolsDir);
- let toolkitURI = this.fileURI(OS.Path.join(srcdir, "toolkit", "devtools"));
- let serverURI = this.fileURI(OS.Path.join(srcdir, "toolkit", "devtools", "server"));
- let webconsoleURI = this.fileURI(OS.Path.join(srcdir, "toolkit", "devtools", "webconsole"));
-+ let cssLogicURI = this.fileURI(OS.Path.join(toolkitURI, "styleinspector", "css-logic"));
-+
- let mainURI = this.fileURI(OS.Path.join(srcdir, "browser", "devtools", "main.js"));
- this.loader = new loader.Loader({
- modules: {
- "toolkit/loader": loader
- },
- paths: {
- "": "resource://gre/modules/commonjs/",
- "devtools/server": serverURI,
- "devtools/toolkit/webconsole": webconsoleURI,
- "devtools": devtoolsURI,
-+ "devtools/styleinspector/css-logic": cssLogicURI,
- "main": mainURI
- },
- globals: loaderGlobals
- });
-
- return this._writeManifest(devtoolsDir).then(null, Cu.reportError);
- },
-
-diff --git a/toolkit/devtools/moz.build b/toolkit/devtools/moz.build
---- a/toolkit/devtools/moz.build
-+++ b/toolkit/devtools/moz.build
-@@ -5,10 +5,11 @@
- # file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
- PARALLEL_DIRS += [
- 'server',
- 'client',
- 'gcli',
- 'sourcemap',
- 'webconsole',
-- 'apps'
-+ 'apps',
-+ 'styleinspector'
- ]
-diff --git a/toolkit/devtools/styleinspector/Makefile.in b/toolkit/devtools/styleinspector/Makefile.in
-new file mode 100644
---- /dev/null
-+++ b/toolkit/devtools/styleinspector/Makefile.in
-@@ -0,0 +1,15 @@
-+# This Source Code Form is subject to the terms of the Mozilla Public
-+# License, v. 2.0. If a copy of the MPL was not distributed with this
-+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-+
-+DEPTH = ../../..
-+topsrcdir = @top_srcdir@
-+srcdir = @srcdir@
-+VPATH = @srcdir@
-+
-+include $(DEPTH)/config/autoconf.mk
-+
-+include $(topsrcdir)/config/rules.mk
-+
-+libs::
-+ $(INSTALL) $(IFLAGS1) $(srcdir)/*.js $(FINAL_TARGET)/modules/devtools/styleinspector
-diff --git a/browser/devtools/styleinspector/css-logic.js b/toolkit/devtools/styleinspector/css-logic.js
-rename from browser/devtools/styleinspector/css-logic.js
-rename to toolkit/devtools/styleinspector/css-logic.js
-diff --git a/toolkit/devtools/styleinspector/moz.build b/toolkit/devtools/styleinspector/moz.build
-new file mode 100644
---- /dev/null
-+++ b/toolkit/devtools/styleinspector/moz.build
-@@ -0,0 +1,5 @@
-+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-+# vim: set filetype=python:
-+# This Source Code Form is subject to the terms of the Mozilla Public
-+# License, v. 2.0. If a copy of the MPL was not distributed with this
-+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
deleted file mode 100644
--- a/promise-return.diff
+++ /dev/null
@@ -1,76 +0,0 @@
-# HG changeset patch
-# User Dave Camp <dcamp@mozilla.com>
-# Date 1374270262 25200
-# Fri Jul 19 14:44:22 2013 -0700
-# Node ID 05edf651c461763fb584de9a6b9ac87c1f71ec3f
-# Parent a3432a61411e4585061f69e75b0a12d7324ecb11
-[mq]: promise-return.diff
-
-diff --git a/toolkit/devtools/server/main.js b/toolkit/devtools/server/main.js
---- a/toolkit/devtools/server/main.js
-+++ b/toolkit/devtools/server/main.js
-@@ -644,16 +644,18 @@ function DebuggerServerConnection(aPrefi
- {
- this._prefix = aPrefix;
- this._transport = aTransport;
- this._transport.hooks = this;
- this._nextID = 1;
-
- this._actorPool = new ActorPool(this);
- this._extraPools = [];
-+
-+ this._actorResponses = new Map;
- }
-
- DebuggerServerConnection.prototype = {
- _prefix: null,
- get prefix() { return this._prefix },
-
- _transport: null,
- get transport() { return this._transport },
-@@ -817,29 +819,32 @@ DebuggerServerConnection.prototype = {
- }
-
- if (!ret) {
- // This should become an error once we've converted every user
- // of this to promises in bug 794078.
- return;
- }
-
-- resolve(ret)
-- .then(null, (e) => {
-- return this._unknownError(
-- "error occurred while processing '" + aPacket.type,
-- e);
-- })
-- .then(function (aResponse) {
-- if (!aResponse.from) {
-- aResponse.from = aPacket.to;
-- }
-- return aResponse;
-- })
-- .then(this.transport.send.bind(this.transport));
-+ let pendingResponse = this._actorResponses.get(actor.actorID) || promise.resolve(null);
-+
-+ let response = pendingResponse.then(() => {
-+ return resolve(ret);
-+ }).then(null, (e) => {
-+ return this._unknownError(
-+ "error occurred while processing '" + aPacket.type,
-+ e);
-+ }).then(function (aResponse) {
-+ if (!aResponse.from) {
-+ aResponse.from = aPacket.to;
-+ }
-+ return aResponse;
-+ }).then(this.transport.send.bind(this.transport));
-+ this._actorResponses.set(actorID, response);
-+ return response;
- },
-
- /**
- * Called by DebuggerTransport when the underlying stream is closed.
- *
- * @param aStatus nsresult
- * The status code that corresponds to the reason for closing
- * the stream.
deleted file mode 100644
--- a/protocol-clientserver-marshallers.diff
+++ /dev/null
@@ -1,62 +0,0 @@
-# HG changeset patch
-# Parent 1e5c93c75b56edfe1ebecd4e83ce1e7490c57aaa
-
-diff --git a/toolkit/devtools/server/protocol.js b/toolkit/devtools/server/protocol.js
---- a/toolkit/devtools/server/protocol.js
-+++ b/toolkit/devtools/server/protocol.js
-@@ -128,21 +128,28 @@ types.getType = function(type) {
- *
- * @returns a type object that can be used in protocol definitions.
- */
- types.addType = function(name, typeObject={}, options={}) {
- if (registeredTypes.has(name)) {
- throw Error("Type '" + name + "' already exists.");
- }
-
-+ let primitive = !(typeObject.clientRead || typeObject.clientWrite ||
-+ typeObject.serverRead || typeObject.serverWrite ||
-+ typeObject.read || typeObject.write);
-+
-+
- let type = object.merge({
- name: name,
-- primitive: !(typeObject.read || typeObject.write),
-- read: v => v,
-- write: v => v
-+ primitive: primitive,
-+ clientRead: typeObject.clientRead || typeObject.read || v => v;
-+ clientWrite: typeObject.clientWrite || typeObject.write || v => v;
-+ serverRead: typeObject.serverRead || typeObject.read || v => v;
-+ serverWrite: typeObject.serverWrite || typeObject.write || v => v;
- }, typeObject);
-
- registeredTypes.set(name, type);
-
- if (!options.thawed) {
- Object.freeze(type);
- }
-
-@@ -163,18 +170,21 @@ types.addArrayType = function(subtype) {
-
- let name = "array:" + subtype.name;
-
- // Arrays of primitive types are primitive types themselves.
- if (subtype.primitive) {
- return types.addType(name);
- }
- return types.addType(name, {
-- read: (v, ctx) => [subtype.read(i, ctx) for (i of v)],
-- write: (v, ctx) => [subtype.write(i, ctx) for (i of v)]
-+
-+ clientRead: (v, ctx) => [subtype.clientRead(i, ctx) for (i of v)],
-+ clientWrite: (v, ctx) => [subtype.clientWrite(i, ctx) for (i of v)]
-+ serverRead: (v, ctx) => [subtype.serverRead(i, ctx) for (i of v)],
-+ serverWrite: (v, ctx) => [subtype.serverWrite(i, ctx) for (i of v)]
- });
- };
-
- /**
- * Add a dict type to the type system. This allows you to serialize
- * a JS object that contains non-primitive subtypes.
- *
- * Properties of the value that aren't included in the specializations
--- a/series
+++ b/series
@@ -1,11 +1,4 @@
-inspector-actorid-detail.diff
-inspector-namespace-fix.diff
-style-editor-baseuri.diff
-move-csslogic.diff
styles-actor.diff
warning-fixes.diff
style-inspector-port.diff
window-targets.diff
-inspector-retain-root.diff #+obsolete
-protocol-clientserver-marshallers.diff #+experimental
-promise-return.diff #+experimental
deleted file mode 100644
--- a/style-editor-baseuri.diff
+++ /dev/null
@@ -1,52 +0,0 @@
-# HG changeset patch
-# User Dave Camp <dcamp@mozilla.com>
-# Date 1374619826 25200
-# Tue Jul 23 15:50:26 2013 -0700
-# Node ID 451135201aa048928428f3348b16a78b525b1fb4
-# Parent f685c843c8fab9ef337eeea0bc198fd135f63781
-[mq]: style-editor-baseuri.diff
-
-diff --git a/browser/devtools/styleeditor/StyleEditorDebuggee.jsm b/browser/devtools/styleeditor/StyleEditorDebuggee.jsm
---- a/browser/devtools/styleeditor/StyleEditorDebuggee.jsm
-+++ b/browser/devtools/styleeditor/StyleEditorDebuggee.jsm
-@@ -118,17 +118,17 @@ StyleEditorDebuggee.prototype = {
- },
-
- /**
- * request baseURIObject information from the document
- */
- _getBaseURI: function() {
- let message = { type: "getBaseURI" };
- this._sendRequest(message, (response) => {
-- this.baseURI = response.baseURI;
-+ this.baseURI = Services.io.newURI(response.baseURI, null, null);
- });
- },
-
- /**
- * Handler for document load, forward event with
- * all the stylesheets available on load.
- *
- * @param {string} type
-diff --git a/toolkit/devtools/server/actors/styleeditor.js b/toolkit/devtools/server/actors/styleeditor.js
---- a/toolkit/devtools/server/actors/styleeditor.js
-+++ b/toolkit/devtools/server/actors/styleeditor.js
-@@ -99,17 +99,17 @@ StyleEditorActor.prototype = {
- },
-
- /**
- * Get the BaseURI for the document.
- *
- * @return {object} JSON message to with BaseURI
- */
- onGetBaseURI: function() {
-- return { baseURI: this.document.baseURIObject };
-+ return { baseURI: this.document.baseURIObject.spec };
- },
-
- /**
- * Called when target navigates to a new document.
- * Adds load listeners to document.
- */
- onNewDocument: function() {
- // delete previous document's actors
--- a/style-inspector-port.diff
+++ b/style-inspector-port.diff
@@ -1,14 +1,14 @@
# HG changeset patch
# User Dave Camp <dcamp@mozilla.com>
# Date 1374619952 25200
# Tue Jul 23 15:52:32 2013 -0700
-# Node ID 52bc42b61b7ba9bed9931f9b9cef863f75214eca
-# Parent 2b17b5f7fca2b109e204e705a12bb66a81b30807
+# Node ID 8f5de07f42c2b3b1d71308a20a0ee1fc04dd3af5
+# Parent 3deebec74623d290af4b7203ffe74f8d96acc256
imported patch style-inspector-port.diff
diff --git a/browser/devtools/framework/target.js b/browser/devtools/framework/target.js
--- a/browser/devtools/framework/target.js
+++ b/browser/devtools/framework/target.js
@@ -287,16 +287,17 @@ TabTarget.prototype = {
// A local TabTarget will never perform chrome debugging.
this._chrome = false;
@@ -295,42 +295,16 @@ diff --git a/browser/devtools/markupview
if (!aIgnoreFocus) {
aContainer.focus();
}
},
/**
* Make sure a node is included in the markup tool.
-diff --git a/browser/devtools/styleeditor/StyleEditorDebuggee.jsm b/browser/devtools/styleeditor/StyleEditorDebuggee.jsm
---- a/browser/devtools/styleeditor/StyleEditorDebuggee.jsm
-+++ b/browser/devtools/styleeditor/StyleEditorDebuggee.jsm
-@@ -117,18 +117,21 @@ StyleEditorDebuggee.prototype = {
- this._sendRequest(message);
- },
-
- /**
- * request baseURIObject information from the document
- */
- _getBaseURI: function() {
- let message = { type: "getBaseURI" };
-+ dump("REQUESTING A BASEURI\n");
- this._sendRequest(message, (response) => {
-- this.baseURI = response.baseURI;
-+ dump("got a base uri!\n");
-+ this.baseURI = Services.io.newURI(response.baseURI, null, null);
-+ dump("this.baseURI IS NOW: " + this.baseURI + "\n");
- });
- },
-
- /**
- * Handler for document load, forward event with
- * all the stylesheets available on load.
- *
- * @param {string} type
diff --git a/browser/devtools/styleinspector/computedview.xhtml b/browser/devtools/styleinspector/computedview.xhtml
--- a/browser/devtools/styleinspector/computedview.xhtml
+++ b/browser/devtools/styleinspector/computedview.xhtml
@@ -93,22 +93,22 @@
-->
<div id="templateMatchedSelectors">
<loop foreach="selector in ${matchedSelectorViews}">
<p>
--- a/styles-actor.diff
+++ b/styles-actor.diff
@@ -1,14 +1,14 @@
# HG changeset patch
# User Dave Camp <dcamp@mozilla.com>
# Date 1374619918 25200
# Tue Jul 23 15:51:58 2013 -0700
-# Node ID fa033ae8ee80efe8165f322bcaa437ab03064095
-# Parent 2325e927a53a7cf2d1c0fb9b07166c8f665bf304
+# Node ID 66402b8a69d769ccc2f798f54fc9d3ee232d4e25
+# Parent ec45d9c75316ed62fefb23693eca946578d7ed68
[mq]: styles-actor.diff
* * *
[mq]: crap.diff
diff --git a/browser/devtools/styleinspector/computed-view.js b/browser/devtools/styleinspector/computed-view.js
--- a/browser/devtools/styleinspector/computed-view.js
+++ b/browser/devtools/styleinspector/computed-view.js
@@ -3,24 +3,28 @@
@@ -868,17 +868,17 @@ diff --git a/toolkit/devtools/server/act
const PSEUDO_CLASSES = [":hover", ":active", ":focus"];
const HIDDEN_CLASS = "__fx-devtools-hide-shortcut__";
const HELPER_SHEET = "." + HIDDEN_CLASS + " { visibility: hidden !important }";
Cu.import("resource://gre/modules/Services.jsm");
-@@ -2075,48 +2076,88 @@ var InspectorActor = protocol.ActorClass
+@@ -2075,48 +2076,87 @@ var InspectorActor = protocol.ActorClass
let deferred = promise.defer();
this._walkerPromise = deferred.promise;
let window = this.window;
var domReady = () => {
let tabActor = this.tabActor;
window.removeEventListener("DOMContentLoaded", domReady, true);
@@ -928,17 +928,16 @@ diff --git a/toolkit/devtools/server/act
// XXX: This is the first actor type in its hierarchy to use the protocol
// library, so we're going to self-own on the client side for now.
client.addActorPool(this);
this.manage(this);
- }
+ },
+
+ getWalker: protocol.custom(function() {
-+ dump("ABOUT TO GET A WALKER\n");
+ return this._getWalker().then(walker => {
+ this.walker = walker;
+ return walker;
+ });
+ }, {
+ impl: "_getWalker"
+ }),
+
@@ -963,17 +962,17 @@ diff --git a/toolkit/devtools/server/act
}
// Exported for test purposes.
exports._documentWalker = documentWalker;
diff --git a/toolkit/devtools/server/actors/styles.js b/toolkit/devtools/server/actors/styles.js
new file mode 100644
--- /dev/null
+++ b/toolkit/devtools/server/actors/styles.js
-@@ -0,0 +1,760 @@
+@@ -0,0 +1,761 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+const {Cc, Ci} = require("chrome");
+const protocol = require("devtools/server/protocol");
@@ -1106,16 +1105,17 @@ new file mode 100644
+ let win = node.rawNode.ownerDocument.defaultView;
+ let ret = Object.create(null);
+
+ this.cssLogic.sourceFilter = options.filter || CssLogic.FILTER.UA;
+ this.cssLogic.highlight(node.rawNode);
+ let computed = this.cssLogic._computedStyle;
+
+ Array.prototype.forEach.call(computed, name => {
++ let matched = undefined;
+ ret[name] = {
+ value: computed.getPropertyValue(name),
+ priority: computed.getPropertyPriority(name) || undefined
+ };
+ });
+
+ if (options.markMatched || options.onlyMatched) {
+ let matched = this.cssLogic.hasMatchedSelectors(Object.keys(ret));
@@ -1130,17 +1130,16 @@ new file mode 100644
+
+ return ret;
+ }, {
+ request: {
+ node: Arg(0, "domnode"),
+ markMatched: Option(1, "boolean"),
+ onlyMatched: Option(1, "boolean"),
+ filter: Option(1, "string"),
-+
+ },
+ response: {
+ computed: RetVal("json")
+ }
+ }),
+
+ /**
+ * Get a list of selectors that match a given property for a node.
@@ -1174,27 +1173,30 @@ new file mode 100644
+ * // The full form of any domrule referenced.
+ * rules: [ <domrule>, ... ], // The full form of any domrule referenced
+ *
+ * // The full form of any sheets referenced.
+ * sheets: [ <domsheet>, ... ]
+ * }
+ */
+ getMatchedSelectors: method(function(node, property, options) {
++ dump("SOURCE FILTER: " + options.filter + "\n");
+ this.cssLogic.sourceFilter = options.filter || CssLogic.FILTER.UA;
+ this.cssLogic.highlight(node.rawNode);
+
+ let walker = node.parent();
+
+ let rules = new Set;
+ let sheets = new Set;
+
+ let matched = [];
+ let propInfo = this.cssLogic.getPropertyInfo(property);
++ dump("GOT A PROP INFO: " + propInfo + "\n");
+ for (let selectorInfo of propInfo.matchedSelectors) {
++ dump("MATCHED SELECTORS\n");
+ let cssRule = selectorInfo.selector._cssRule;
+ let domRule = cssRule.sourceElement || cssRule._domRule;
+
+ let rule = this._styleRef(domRule);
+ rules.add(rule);
+
+ matched.push({
+ rule: rule,
@@ -1210,17 +1212,17 @@ new file mode 100644
+ return {
+ matched: matched,
+ rules: [...rules],
+ sheets: [...sheets],
+ }
+ }, {
+ request: {
+ node: Arg(0, "domnode"),
-+ properties: Arg(1, "string"),
++ property: Arg(1, "string"),
+ filter: Option(2, "string")
+ },
+ response: RetVal(types.addDictType("matchedselectorresponse", {
+ rules: "array:domstylerule",
+ sheets: "array:domsheet",
+ matched: "array:matchedselector"
+ }))
+ }),
@@ -1409,18 +1411,18 @@ new file mode 100644
+ destroy: function() {
+ protocol.Front.prototype.destroy.call(this);
+ },
+
+ get walker() {
+ return this.inspector.walker;
+ },
+
-+ getMatchedSelectors: protocol.custom(function(node, property) {
-+ return this._getMatchedSelectors(node, property).then(ret => {
++ getMatchedSelectors: protocol.custom(function(node, property, options) {
++ return this._getMatchedSelectors(node, property, options).then(ret => {
+ return ret.matched;
+ });
+ }, {
+ impl: "_getMatchedSelectors"
+ }),
+
+ getApplied: protocol.custom(function(node, options={}) {
+ return this._getApplied(node, options).then(ret => {
@@ -1594,23 +1596,21 @@ new file mode 100644
+ * name: <string>,
+ * }
+ *
+ * @returns the rule with updated properties
+ */
+ modifyProperties: method(function(modifications) {
+ for (let mod of modifications) {
+ if (mod.type === "set") {
-+ dump("setting property\n");
+ this.rawStyle.setProperty(mod.name, mod.value, mod.priority || "");
+ } else if (mod.type === "remove") {
+ this.rawStyle.removeProperty(mod.name);
+ }
+ }
-+ dump(this.rawStyle.cssText + "\n");
+ return this;
+ }, {
+ request: { modifications: Arg(0, "array:json") },
+ response: { rule: RetVal("domstylerule") }
+ })
+});
+
+/**
@@ -1636,17 +1636,17 @@ new file mode 100644
+ this._mediaText = null;
+ }
+ },
+
+ /**
+ * Return a new RuleModificationList for this node.
+ */
+ startModifyingProperties: function() {
-+ return new RuleModificationList(this);
++ return new RuleModificationList(this);
+ },
+
+ get type() this._form.type,
+ get line() this._form.line || -1,
+ get cssText() {
+ return this._form.cssText;
+ },
+ get selectors() {
@@ -1727,52 +1727,63 @@ new file mode 100644
+ name: name
+ });
+ }
+});
+
diff --git a/toolkit/devtools/server/tests/mochitest/Makefile.in b/toolkit/devtools/server/tests/mochitest/Makefile.in
--- a/toolkit/devtools/server/tests/mochitest/Makefile.in
+++ b/toolkit/devtools/server/tests/mochitest/Makefile.in
-@@ -9,27 +9,30 @@ srcdir = @srcdir@
+@@ -9,27 +9,33 @@ srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = @relativesrcdir@
include $(DEPTH)/config/autoconf.mk
MOCHITEST_CHROME_FILES = \
inspector-helpers.js \
inspector-traversal-data.html \
+ inspector-styles-data.html \
++ inspector-styles-data.css \
test_inspector-changeattrs.html \
test_inspector-changevalue.html \
test_inspector-hide.html \
test_inspector-insert.html \
test_inspector-mutations-attr.html \
test_inspector-mutations-childlist.html \
test_inspector-mutations-frameload.html \
test_inspector-mutations-value.html \
test_inspector-release.html \
test_inspector-remove.html \
test_inspector-reload.html \
test_inspector-retain.html \
test_inspector-pseudoclass-lock.html \
test_inspector-traversal.html \
+ test_styles-applied.html \
++ test_styles-computed.html \
++ test_styles-matched.html \
+ test_styles-modify.html \
test_unsafeDereference.html \
nonchrome_unsafeDereference.html \
$(NULL)
include $(topsrcdir)/config/rules.mk
+diff --git a/toolkit/devtools/server/tests/mochitest/inspector-styles-data.css b/toolkit/devtools/server/tests/mochitest/inspector-styles-data.css
+new file mode 100644
+--- /dev/null
++++ b/toolkit/devtools/server/tests/mochitest/inspector-styles-data.css
+@@ -0,0 +1,3 @@
++.external-rule {
++ cursor: crosshair;
++}
diff --git a/toolkit/devtools/server/tests/mochitest/inspector-styles-data.html b/toolkit/devtools/server/tests/mochitest/inspector-styles-data.html
new file mode 100644
--- /dev/null
+++ b/toolkit/devtools/server/tests/mochitest/inspector-styles-data.html
-@@ -0,0 +1,39 @@
+@@ -0,0 +1,48 @@
+<html>
+<script>
+ window.onload = () => {
+ window.opener.postMessage('ready', '*')
+ }
+</script>
+<style>
+ .inheritable-rule {
@@ -1782,30 +1793,39 @@ new file mode 100644
+ background-color: #f06;
+ }
+ @media screen {
+ #mediaqueried {
+ background-color: #f06;
+ }
+ }
+</style>
++<link type="text/css" rel="stylesheet" href="inspector-styles-data.css"></link>
+<body>
+ <h1>Style Actor Tests</h1>
+ <!-- Inheritance checks -->
+ <div id="inheritable-rule-uninheritable-style" class="inheritable-rule" style="background-color: purple">
+ <div id="inheritable-rule-inheritable-style" class="inheritable-rule" style="color: blue">
+ <div id="uninheritable-rule-uninheritable-style" class="uninheritable-rule" style="background-color: green">
+ <div id="uninheritable-rule-inheritable-style" class="uninheritable-rule" style="color: red">
+ <div id="test-node">
+ Here is the test node.
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
++
++ <!-- Computed checks -->
++ <div id="computed-parent" class="external-rule inheritable-rule uninheritable-rule" style="color: red;">
++ <div id="computed-test-node" style="font-size: 10px" class="external-rule">
++ Here is the test node.
++ </div>
++ </div>
++
+ <div id="mediaqueried">
+ Screen mediaqueried.
+ </div>
+
+</body>
+</html>
diff --git a/toolkit/devtools/server/tests/mochitest/inspector-traversal-data.html b/toolkit/devtools/server/tests/mochitest/inspector-traversal-data.html
--- a/toolkit/devtools/server/tests/mochitest/inspector-traversal-data.html
@@ -1995,16 +2015,269 @@ new file mode 100644
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
+diff --git a/toolkit/devtools/server/tests/mochitest/test_styles-computed.html b/toolkit/devtools/server/tests/mochitest/test_styles-computed.html
+new file mode 100644
+--- /dev/null
++++ b/toolkit/devtools/server/tests/mochitest/test_styles-computed.html
+@@ -0,0 +1,142 @@
++<!DOCTYPE HTML>
++<html>
++<!--
++https://bugzilla.mozilla.org/show_bug.cgi?id=
++-->
++<head>
++ <meta charset="utf-8">
++ <title>Test for Bug </title>
++
++ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
++ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
++ <script type="application/javascript;version=1.8" src="inspector-helpers.js"></script>
++ <script type="application/javascript;version=1.8">
++Components.utils.import("resource://gre/modules/devtools/Loader.jsm");
++
++const promise = devtools.require("sdk/core/promise");
++const inspector = devtools.require("devtools/server/actors/inspector");
++
++window.onload = function() {
++ SimpleTest.waitForExplicitFinish();
++ runNextTest();
++}
++
++var gWalker = null;
++var gStyles = null;
++var gClient = null;
++
++addTest(function setup() {
++ let url = document.getElementById("inspectorContent").href;
++ attachURL(url, function(err, client, tab, doc) {
++ gInspectee = doc;
++ let {InspectorFront} = devtools.require("devtools/server/actors/inspector");
++ let inspector = InspectorFront(client, tab);
++ promiseDone(inspector.getWalker().then(walker => {
++ ok(walker, "getWalker() should return an actor.");
++ gClient = client;
++ gWalker = walker;
++ return inspector.getPageStyle();
++ }).then(styles => {
++ gStyles = styles;
++ }).then(runNextTest));
++ });
++});
++
++addTest(function testComputed() {
++ let localNode = gInspectee.querySelector("#computed-test-node");
++ let elementStyle = null;
++ promiseDone(gWalker.querySelector(gWalker.rootNode, "#computed-test-node").then(node => {
++ return gStyles.getComputed(node, {});
++ }).then(computed => {
++ // Test a smattering of properties that include some system-defined
++ // props, some props that were defined in this node's stylesheet,
++ // and some default props.
++ is(computed["white-space"].value, "normal", "Default value should appear");
++ is(computed["display"].value, "block", "System stylesheet item should appear");
++ is(computed["cursor"].value, "crosshair", "Included stylesheet rule should appear");
++ is(computed["color"].value, "rgb(255, 0, 0)", "Inherited style attribute should appear");
++ is(computed["font-size"].value, "15px", "Inherited inline rule should appear");
++
++ // We didn't request markMatched, so these shouldn't be set
++ ok(!computed["cursor"].matched, "Didn't ask for matched, shouldn't get it");
++ ok(!computed["color"].matched, "Didn't ask for matched, shouldn't get it");
++ ok(!computed["font-size"].matched, "Didn't ask for matched, shouldn't get it");
++ }).then(runNextTest));
++});
++
++addTest(function testComputedUserMatched() {
++ let localNode = gInspectee.querySelector("#computed-test-node");
++ let elementStyle = null;
++ promiseDone(gWalker.querySelector(gWalker.rootNode, "#computed-test-node").then(node => {
++ return gStyles.getComputed(node, { filter: "user", markMatched: true });
++ }).then(computed => {
++ ok(!computed["white-space"].matched, "Default style shouldn't match");
++ ok(!computed["display"].matched, "Only user styles should match");
++ ok(computed["cursor"].matched, "Asked for matched, should get it");
++ ok(computed["color"].matched, "Asked for matched, should get it");
++ ok(computed["font-size"].matched, "Asked for matched, should get it");
++ }).then(runNextTest));
++});
++
++addTest(function testComputedSystemMatched() {
++ let localNode = gInspectee.querySelector("#computed-test-node");
++ let elementStyle = null;
++ promiseDone(gWalker.querySelector(gWalker.rootNode, "#computed-test-node").then(node => {
++ return gStyles.getComputed(node, { filter: "ua", markMatched: true });
++ }).then(computed => {
++ ok(!computed["white-space"].matched, "Default style shouldn't match");
++ ok(computed["display"].matched, "System stylesheets should match");
++ ok(computed["cursor"].matched, "Asked for matched, should get it");
++ ok(computed["color"].matched, "Asked for matched, should get it");
++ ok(computed["font-size"].matched, "Asked for matched, should get it");
++ }).then(runNextTest));
++});
++
++addTest(function testComputedUserOnlyMatched() {
++ let localNode = gInspectee.querySelector("#computed-test-node");
++ let elementStyle = null;
++ promiseDone(gWalker.querySelector(gWalker.rootNode, "#computed-test-node").then(node => {
++ return gStyles.getComputed(node, { filter: "user", onlyMatched: true });
++ }).then(computed => {
++ ok(!("white-space" in computed), "Default style shouldn't exist");
++ ok(!("display" in computed), "System stylesheets shouldn't exist");
++ ok(("cursor" in computed), "User items should exist.");
++ ok(("color" in computed), "User items should exist.");
++ ok(("font-size" in computed), "User items should exist.");
++ }).then(runNextTest));
++});
++
++addTest(function testComputedSystemOnlyMatched() {
++ let localNode = gInspectee.querySelector("#computed-test-node");
++ let elementStyle = null;
++ promiseDone(gWalker.querySelector(gWalker.rootNode, "#computed-test-node").then(node => {
++ return gStyles.getComputed(node, { filter: "ua", onlyMatched: true });
++ }).then(computed => {
++ ok(!("white-space" in computed), "Default style shouldn't exist");
++ ok(("display" in computed), "System stylesheets should exist");
++ ok(("cursor" in computed), "User items should exist.");
++ ok(("color" in computed), "User items should exist.");
++ ok(("font-size" in computed), "User items should exist.");
++ }).then(runNextTest));
++});
++
++addTest(function cleanup() {
++ delete gStyles;
++ delete gWalker;
++ delete gClient;
++ runNextTest();
++});
++
++ </script>
++</head>
++<body>
++<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
++<a id="inspectorContent" target="_blank" href="inspector-styles-data.html">Test Document</a>
++<p id="display"></p>
++<div id="content" style="display: none">
++
++</div>
++<pre id="test">
++</pre>
++</body>
++</html>
+diff --git a/toolkit/devtools/server/tests/mochitest/test_styles-matched.html b/toolkit/devtools/server/tests/mochitest/test_styles-matched.html
+new file mode 100644
+--- /dev/null
++++ b/toolkit/devtools/server/tests/mochitest/test_styles-matched.html
+@@ -0,0 +1,101 @@
++<!DOCTYPE HTML>
++<html>
++<!--
++https://bugzilla.mozilla.org/show_bug.cgi?id=
++-->
++<head>
++ <meta charset="utf-8">
++ <title>Test for Bug </title>
++
++ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
++ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
++ <script type="application/javascript;version=1.8" src="inspector-helpers.js"></script>
++ <script type="application/javascript;version=1.8">
++Components.utils.import("resource://gre/modules/devtools/Loader.jsm");
++
++const promise = devtools.require("sdk/core/promise");
++const inspector = devtools.require("devtools/server/actors/inspector");
++const {CssLogic} = devtools.require("devtools/styleinspector/css-logic");
++
++window.onload = function() {
++ SimpleTest.waitForExplicitFinish();
++ runNextTest();
++}
++
++var gWalker = null;
++var gStyles = null;
++var gClient = null;
++
++addTest(function setup() {
++ let url = document.getElementById("inspectorContent").href;
++ attachURL(url, function(err, client, tab, doc) {
++ gInspectee = doc;
++ let {InspectorFront} = devtools.require("devtools/server/actors/inspector");
++ let inspector = InspectorFront(client, tab);
++ promiseDone(inspector.getWalker().then(walker => {
++ ok(walker, "getWalker() should return an actor.");
++ gClient = client;
++ gWalker = walker;
++ return inspector.getPageStyle();
++ }).then(styles => {
++ gStyles = styles;
++ }).then(runNextTest));
++ });
++});
++
++addTest(function testMatchedStyles() {
++ promiseDone(gWalker.querySelector(gWalker.rootNode, "#computed-test-node").then(node => {
++ return gStyles.getMatchedSelectors(node, "font-size", {});
++ }).then(matched => {
++ is(matched[0].sourceText, "this.style", "First match comes from the element style");
++ is(matched[0].selector, "@element.style", "Element style has a special selector");
++ is(matched[0].value, "10px", "First match has the expected value");
++ is(matched[0].status, CssLogic.STATUS.BEST, "First match is the best match")
++ is(matched[0].rule.type, 100, "First match is an element style");
++ is(matched[0].rule.href, gInspectee.defaultView.location.href, "Node style comes from this document")
++
++ is(matched[1].sourceText, ".inheritable-rule", "Second match comes from a rule");
++ is(matched[1].selector, ".inheritable-rule", "Second style has a selector");
++ is(matched[1].value, "15px", "Second match has the expected value");
++ is(matched[1].status, CssLogic.STATUS.PARENT_MATCH, "Second match is from the parent")
++ is(matched[1].rule.parentStyleSheet.href, null, "Inline stylesheet shouldn't have an href");
++ is(matched[1].rule.parentStyleSheet.nodeHref, gInspectee.defaultView.location.href, "Inline stylesheet's nodeHref should match the current document");
++ ok(!matched[1].rule.parentStyleSheet.system, "Inline stylesheet shouldn't be a system stylesheet.");
++ }).then(runNextTest));
++});
++
++addTest(function testSystemStyles() {
++ let testNode = null;
++
++ promiseDone(gWalker.querySelector(gWalker.rootNode, "#computed-test-node").then(node => {
++ testNode = node;
++ return gStyles.getMatchedSelectors(testNode, "display", { filter: "user" });
++ }).then(matched => {
++ is(matched.length, 0, "No user selectors apply to this rule.");
++ return gStyles.getMatchedSelectors(testNode, "display", { filter: "ua" });
++ }).then(matched => {
++ is(matched[0].selector, "div", "Should match system div selector");
++ is(matched[0].value, "block");
++ }).then(runNextTest));
++});
++
++addTest(function cleanup() {
++ delete gStyles;
++ delete gWalker;
++ delete gClient;
++ runNextTest();
++});
++
++ </script>
++</head>
++<body>
++<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
++<a id="inspectorContent" target="_blank" href="inspector-styles-data.html">Test Document</a>
++<p id="display"></p>
++<div id="content" style="display: none">
++
++</div>
++<pre id="test">
++</pre>
++</body>
++</html>
diff --git a/toolkit/devtools/server/tests/mochitest/test_styles-modify.html b/toolkit/devtools/server/tests/mochitest/test_styles-modify.html
new file mode 100644
--- /dev/null
+++ b/toolkit/devtools/server/tests/mochitest/test_styles-modify.html
@@ -0,0 +1,103 @@
+<!DOCTYPE HTML>
+<html>
+<!--
@@ -2154,36 +2427,17 @@ diff --git a/toolkit/devtools/styleinspe
};
/**
* Known media values. To distinguish "all" stylesheets (above) from "all" media
* The full list includes braille, embossed, handheld, print, projection,
* speech, tty, and tv, but this is only a hack because these are not defined
* in the DOM at all.
* @see http://www.w3.org/TR/CSS21/media.html#media-types
-@@ -138,16 +139,18 @@ CssLogic.prototype = {
- this._matchedSelectors = null;
- },
-
- /**
- * Focus on a new element - remove the style caches.
- *
- * @param {nsIDOMElement} aViewedElement the element the user has highlighted
- * in the Inspector.
-+ *
-+ * @returns a promise that will be resolved when CssLogic is up to date.
- */
- highlight: function CssLogic_highlight(aViewedElement)
- {
- if (!aViewedElement) {
- this.viewedElement = null;
- this.viewedDocument = null;
- this._computedStyle = null;
- this.reset();
-@@ -750,17 +753,17 @@ CssLogic.isContentStylesheet = function
+@@ -750,17 +751,17 @@ CssLogic.isContentStylesheet = function
*
* @param {CSSStyleSheet} aSheet the DOM object for the style sheet.
* @return {string} the address of the stylesheet.
*/
CssLogic.href = function CssLogic_href(aSheet)
{
let href = aSheet.href;
if (!href) {
@@ -2192,26 +2446,8 @@ diff --git a/toolkit/devtools/styleinspe
}
return href;
};
/**
* Return a shortened version of a style sheet's source.
*
-@@ -1128,16 +1131,17 @@ CssSheet.prototype = {
- * to cache data. If the rule comes from element.style, then provide
- * an object of the form: {style: element.style}.
- * @param {Element} [aElement] If the rule comes from element.style, then this
- * argument must point to the element.
- * @constructor
- */
- function CssRule(aCssSheet, aDomRule, aElement)
- {
-+ dump("Creating rule: " + aDomRule + "\n");
- this._cssSheet = aCssSheet;
- this._domRule = aDomRule;
-
- let parentRule = aDomRule.parentRule;
- if (parentRule && parentRule.type == Ci.nsIDOMCSSRule.MEDIA_RULE) {
- this.mediaText = parentRule.media.mediaText;
- }
-
--- a/warning-fixes.diff
+++ b/warning-fixes.diff
@@ -1,14 +1,14 @@
# HG changeset patch
# User Dave Camp <dcamp@mozilla.com>
# Date 1371477174 25200
# Mon Jun 17 06:52:54 2013 -0700
-# Node ID b1234d4c191aa44e83207f07c2be6c9a8f489554
-# Parent 6070992bdde6e39b5e32ebc7e6c43dcf649e4e0b
+# Node ID 3deebec74623d290af4b7203ffe74f8d96acc256
+# Parent 66402b8a69d769ccc2f798f54fc9d3ee232d4e25
imported patch warning-fixes.diff
diff --git a/browser/devtools/shared/inplace-editor.js b/browser/devtools/shared/inplace-editor.js
--- a/browser/devtools/shared/inplace-editor.js
+++ b/browser/devtools/shared/inplace-editor.js
@@ -413,17 +413,17 @@ InplaceEditor.prototype = {
--selStart;
}
--- a/window-targets.diff
+++ b/window-targets.diff
@@ -1,14 +1,14 @@
# HG changeset patch
# User Dave Camp <dcamp@mozilla.com>
# Date 1372178155 25200
# Tue Jun 25 09:35:55 2013 -0700
-# Node ID 6070992bdde6e39b5e32ebc7e6c43dcf649e4e0b
-# Parent 03c2f346b15f571ae25b78c586210f09359290c2
+# Node ID 047187f98de0972dc91573b65cfc7b8759fdcad0
+# Parent 8f5de07f42c2b3b1d71308a20a0ee1fc04dd3af5
imported patch window-targets.diff
* * *
imported patch custom-windows.diff
diff --git a/browser/devtools/framework/target.js b/browser/devtools/framework/target.js
--- a/browser/devtools/framework/target.js
+++ b/browser/devtools/framework/target.js
@@ -77,17 +77,19 @@ exports.TargetFactory = {