Created
May 20, 2015 14:44
-
-
Save mikehenrty/6c506767b0fb15aaa2d4 to your computer and use it in GitHub Desktop.
Mozilla-Central patch for linked data events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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