Skip to content

Commit

Permalink
Bug 1178484 - Part 4: Fire metachange event when a <meta> tag has Ope…
Browse files Browse the repository at this point in the history
…n Graph data. r=kanru
  • Loading branch information
tedders1 committed Aug 28, 2015
1 parent 675740b commit 069dfd2
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions dom/browser-element/BrowserElementChildPreload.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,33 +569,42 @@ BrowserElementChild.prototype = {
return;
}

if (!e.target.name) {
var name = e.target.name;
var property = e.target.getAttributeNS(null, "property");

if (!name && !property) {
return;
}

debug('Got metaChanged: (' + e.target.name + ') ' + e.target.content);
debug('Got metaChanged: (' + (name || property) + ') ' +
e.target.content);

let handlers = {
'viewmode': this._genericMetaHandler.bind(null, 'viewmode'),
'theme-color': this._genericMetaHandler.bind(null, 'theme-color'),
'theme-group': this._genericMetaHandler.bind(null, 'theme-group'),
'viewmode': this._genericMetaHandler,
'theme-color': this._genericMetaHandler,
'theme-group': this._genericMetaHandler,
'application-name': this._applicationNameChangedHandler
};
let handler = handlers[name];

if ((property || name).match(/^og:/)) {
name = property || name;
handler = this._genericMetaHandler;
}

let handler = handlers[e.target.name];
if (handler) {
handler(e.type, e.target);
handler(name, e.type, e.target);
}
},

_applicationNameChangedHandler: function(eventType, target) {
_applicationNameChangedHandler: function(name, eventType, target) {
if (eventType !== 'DOMMetaAdded') {
// Bug 1037448 - Decide what to do when <meta name="application-name">
// changes
return;
}

let meta = { name: 'application-name',
let meta = { name: name,
content: target.content };

let lang;
Expand Down

0 comments on commit 069dfd2

Please sign in to comment.