Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Crash fix with <object> in DOM #1931

Closed
wants to merge 1 commit into from
Closed

Conversation

pascalm
Copy link

@pascalm pascalm commented Jan 31, 2013

When elements in the DOM are bound to browser plugins, the properties of this DOM element are defined by the plugin and thus the attribute childNode may not exist.

Without this fix, angular crashes when it encounters an element without the childNodes property.

@IgorMinar
Copy link
Contributor

can you provide a test case please?

@pascalm
Copy link
Author

pascalm commented Feb 9, 2013

I have been thinking about how to build a test case for this issue, but I really can't find a way without having to provide a C++ browser plugin, which is platform dependent.... So, here are some detailed explanations on the case for which I encountered the crash, maybe you will be able to help with how to create a testcase that fits in your framework.

I have a custom browser plugin based on FireBreath which is instantiated in my pages through an OBJECT HTML element:

<object id="plugin" type="application/x-testplugin" width="300" height="300">
</object>

I access the exposed methods/attributes of this plugin in javascript:

plugin = document.getElementById("plugin")
plugin.valid;

which means that if the plugin doesn't expose a childNodes attribute, then it doesn't exists...

If you have any advice on how to implement the case within your test framework, I'll see if I can implement it.

Thanks !

@mhevery
Copy link
Contributor

mhevery commented Feb 15, 2013

Thanks for your contribution! In order for us to be able to accept it, we ask you to sign our CLA (contributor's license agreement).

CLA is important for us to be able to avoid legal troubles down the road.

For individuals (a simple click-through form):
http://code.google.com/legal/individual-cla-v1.0.html

For corporations (print, sign and scan+email, fax or mail):
http://code.google.com/legal/corporate-cla-v1.0.html

@IgorMinar
Copy link
Contributor

Can we just use regular dom in the test, but mokeypatch one of the elements and set childNodes to null?

delete seems to work. we might need to disable the test on IE but that's fine:

x = document.createElement('object')
<object>​</object>​
x.childNodes
[]
x.childNodes = null
null
x.childNodes
[]
delete x.childNodes
true
x.childNodes
undefined

we should have a test for it otherwise we'll never remember why that check was there - especially when porting stuff to DOMinatrix.

@IgorMinar
Copy link
Contributor

no CLA. I reimplemented the change and added tests.

the changes landed as bec614f

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants