Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mozilla-Central patch for linked data events
diff --git a/dom/browser-element/BrowserElementChildPreload.js b/dom/browser-element/BrowserElementChildPreload.js
--- a/dom/browser-element/BrowserElementChildPreload.js
+++ b/dom/browser-element/BrowserElementChildPreload.js
@@ -515,22 +515,28 @@ BrowserElementChild.prototype = {
let win = e.target.ownerDocument.defaultView;
// Ignore metas which don't come from the top-level
// <iframe mozbrowser> window.
if (win != content) {
debug('Not top level!');
return;
}
- if (!e.target.name) {
+ if (!e.target.name && !e.target.getAttribute('property')) {
return;
}
debug('Got metaChanged: (' + e.target.name + ') ' + e.target.content);
+ var name = e.target.name || e.target.getAttribute('property');
+ if (name.startsWith('og:')) {
+ this._ogChangedHandler(e.type, e.target);
+ return;
+ }
+
let handlers = {
'theme-color': this._themeColorChangedHandler,
'application-name': this._applicationNameChangedHandler
};
let handler = handlers[e.target.name];
if (handler) {
handler(e.type, e.target);
@@ -694,16 +700,25 @@ BrowserElementChild.prototype = {
detail.rect.left += currentRect.left;
detail.rect.right += currentRect.left;
currentWindow = currentWindow.realFrameElement.ownerDocument.defaultView;
}
sendAsyncMsg('selectionstatechanged', detail);
},
+ _ogChangedHandler: function(eventType, target) {
+ let meta = {
+ name: target.name || target.getAttribute('property'),
+ content: target.content,
+ type: eventType.replace('DOMMeta', '').toLowerCase()
+ };
+ sendAsyncMsg('metachange', meta);
+ },
+
_themeColorChangedHandler: function(eventType, target) {
let meta = {
name: 'theme-color',
content: target.content,
type: eventType.replace('DOMMeta', '').toLowerCase()
};
sendAsyncMsg('metachange', meta);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment