-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Javascript errors with Firebreath plugin #3309
Comments
I can also confirm this error. It fails in Firefox as well, although somewhat differently:
You can see that it's the same line-number and expression failing. (Angular.js:503) As far as my testing goes, it only seems to affect actual Firebreath-plugins. Using the provided test-html with a the non-existant plugin-type ("application/x-firebreath-plugin") will not trigger the error. Replacing the type for an actual Firebreath plugin and Angular immeditaly crashes on load. |
+1 Running into the same problem using https://code.google.com/p/fbvlc/ I get this error simply using the element inside of $rootScope (meaning an element up the hierarchy has the ng-app attribute). I think I'm going to cry if I'm not able to use Angular for this project. =.[ It can be hack-fixed by wrapping this conditional around the first case of the switch(nodeType) in collectDirectives():
My assumption is that it will prevent you tying a directive directly to your FB plugin, but you should be able to just wrap it and move on. I'll follow up if I find any other issues. Btw, this seems to only happen in FireFox/Chrome where you have an NPAPI plugin. FireBreath seems a little broken. If you console.log(document.getElementById('plugin')), you get "TypeError", but it has a bunch of properties (just not a nodeName). IE seems to be fine, I assume because ActiveX is a little more mature/cared for? Not sure. Update: NPAPI plugins with FB are a little broken: http://stackoverflow.com/a/18623136/158502, and I think my fix here is probably totally safe -- if an element doesn't have a nodeName, then there's probably not much Angular can do about it anyway. |
/watch |
in 1.2.0 it can be fixed by checking element[0] for 'undefined'. Assuming that this is plugin object. } else {
nodeName_ = function(element) {
return element.nodeName ? element.nodeName : element[0].nodeName;
}; with this: } else {
nodeName_ = function (element) {
return element.nodeName ? element.nodeName : !isUndefined(element[0]) ? element[0].nodeName : 'TypeError';
}; so the nodeName_ will be 'TypeError' or whatever you like OR .directive('rtplugin', ['$compile', function($compile) {
return {
link: function(scope, elm, attrs) {
var plugintmpl = '<object type="application/x-rutoken-pki" id="plugin-object" width="0" height="0"><param name="onload" value="pluginLoaded"></object>';
var b = $compile(plugintmpl)(scope);
elm.html(b);
}
};
}]) |
I don't want to monkey patch AngularJS :P - it's not a direct issue of AngularJS. But the problem is the Firebreath Plugin itself. I've tried to create an issue in the projects jira ( http://jira.firebreath.org/ ) btw fyi: techcrunch.com/2013/09/23/say-goodbye-to-npapi/ |
Thanks for the links @robinboehm, that's really unfortunate. The author of FireBreath has stated on multiple occasions that he likely won't put the time/effort into fixing this problem with NPAPI... I suppose with the news of NPAPI being shuttered, that guarantees this problem won't be fixed on either end... monkey patch seems to be the only answer for now. ;) |
Ok - Issue could be closed. |
Thanks @robinboehm |
@blade-runner Thanks for sharing your example. I was able to get your directive technique to work without jQuery by changing |
I'm having some issues with a Firebreath plugin, similar to #1931
Don't know how to reproduce without a Firebreath plugin installed, but this is the minimal HTML that reproduces on my machine:
Assuming x-firebreath-plugin is installed, when inspecting the object node in Chrome (document.getElementById('plugin')), it is simply the string "TypeError".
On page load I get javascript errors from AngularJS with the following stacktrace:
TypeError: Cannot read property 'nodeName' of undefined
at nodeName_ (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.js:503:60)
at collectDirectives (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.js:4580:34)
at compileNodes (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.js:4496:22)
at compileNodes (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.js:4504:15)
at compile (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.js:4437:29)
at http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.js:1006:11
at Object.Scope.$eval (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.js:8926:28)
at Object.Scope.$apply (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.js:9006:23)
at http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.js:1004:15
at Object.invoke (http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.js:2925:25)
The nodeName_ function should maybe check element a bit more? Or should this be handled in compileNodes or another place?
The text was updated successfully, but these errors were encountered: