зеркало из https://github.com/mozilla/gecko-dev.git
Bug 967201 - "Copy Unique Selector" doesn't place anything in the clipboard in e10s windows and Browser Toolbox". r=pbrosset
This commit is contained in:
Родитель
cf1ba85b7d
Коммит
3e1921dba7
|
@ -106,6 +106,10 @@ InspectorPanel.prototype = {
|
|||
return this._target.client.traits.urlToImageDataResolver;
|
||||
},
|
||||
|
||||
get canGetUniqueSelector() {
|
||||
return this._target.client.traits.getUniqueSelector;
|
||||
},
|
||||
|
||||
_deferredOpen: function(defaultSelection) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
|
@ -624,6 +628,9 @@ InspectorPanel.prototype = {
|
|||
copyInnerHTML.setAttribute("disabled", "true");
|
||||
copyOuterHTML.setAttribute("disabled", "true");
|
||||
}
|
||||
if (!this.canGetUniqueSelector) {
|
||||
unique.hidden = true;
|
||||
}
|
||||
|
||||
// Enable the "edit HTML" item if the selection is an element and the root
|
||||
// actor has the appropriate trait (isOuterHTMLEditable)
|
||||
|
@ -842,10 +849,9 @@ InspectorPanel.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
let toCopy = CssLogic.findCssSelector(this.selection.node);
|
||||
if (toCopy) {
|
||||
clipboardHelper.copyString(toCopy);
|
||||
}
|
||||
this.selection.nodeFront.getUniqueSelector().then((selector) => {
|
||||
clipboardHelper.copyString(selector);
|
||||
}).then(null, console.error);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -562,6 +562,18 @@ var NodeActor = exports.NodeActor = protocol.ActorClass({
|
|||
response: {}
|
||||
}),
|
||||
|
||||
/**
|
||||
* Get a unique selector string for this node.
|
||||
*/
|
||||
getUniqueSelector: method(function() {
|
||||
return CssLogic.findCssSelector(this.rawNode);
|
||||
}, {
|
||||
request: {},
|
||||
response: {
|
||||
value: RetVal("string")
|
||||
}
|
||||
}),
|
||||
|
||||
/**
|
||||
* Get the node's image data if any (for canvas and img nodes).
|
||||
* Returns an imageData object with the actual data being a LongStringActor
|
||||
|
|
|
@ -143,7 +143,9 @@ RootActor.prototype = {
|
|||
selectorEditable: true,
|
||||
// Whether the page style actor implements the addNewRule method that
|
||||
// adds new rules to the page
|
||||
addNewRule: true
|
||||
addNewRule: true,
|
||||
// Whether the dom node actor implements the getUniqueSelector method
|
||||
getUniqueSelector: true
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче