FireBreath

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • FireBreath Core
  • FIREBREATH-177

Firebreath will not create plugin window when object tag has data attribute and without and param tag

  • Log In
  • Views
    • JSON (beta)
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: FireBreath 1.6.0
  • Fix Version/s: FireBreath 1.7.0
  • Environment:

    Windows 7 x64, IE9
    Visual Studio 2010

  • Operating System:
    Windows
  • Web Browser:
    Internet Explorer 9

Description

I've created a plugin which will automatically load the file specified with data attribute of object tag. On IE9, if object tag was created without any <param> tag, then firebreath will not automatically create the plugin window, so onWindowAttached will get a null window.

Other browsers works with or without <param>, I only tested on IE9, no other versions.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. HTML File
    FBControl.htm
    Jul 3, 2012 07:50
    2 kB
    doug mansell
  2. File
    projects.rar
    May 17, 2012 19:43
    342 kB
    Steve Yin

Issue Links

mentioned in

Wiki Page Loading...

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • History
  • Activity
  • Git Commits
  • Source
Hide
Permalink
Richard Bateman added a comment - May 17, 2012 09:12

I have never seen an issue similar to this and I use my plugin on IE9 all the time; I need an example project that reproduces the issue or I will have to reject it because I have no idea how to repro it.

Show
Richard Bateman added a comment - May 17, 2012 09:12 I have never seen an issue similar to this and I use my plugin on IE9 all the time; I need an example project that reproduces the issue or I will have to reject it because I have no idea how to repro it.
Hide
Permalink
Steve Yin added a comment - May 17, 2012 19:43 - edited

I've attached a test project with it's compiled binary, with modified FBControl.htm,

After register the dll, load the htm in IE9, you will see only first <object> has some info drawed into it's canvas, I just modified the generated source onMouseMove function to draw some text within the window client.

these two <object> in html both have a data attribute points to a existing readme.txt, but the second <object> don't have and <param> nested, so I don't draw at all.

Show
Steve Yin added a comment - May 17, 2012 19:43 - edited I've attached a test project with it's compiled binary, with modified FBControl.htm, After register the dll, load the htm in IE9, you will see only first <object> has some info drawed into it's canvas, I just modified the generated source onMouseMove function to draw some text within the window client. these two <object> in html both have a data attribute points to a existing readme.txt, but the second <object> don't have and <param> nested, so I don't draw at all.
Hide
Permalink
Richard Bateman added a comment - May 17, 2012 19:50

I'm a bit behind on another project, so it may be a week or two before I can look at this, but I'll try to get to it before too long.

As a side note, you nearly always want to use the onload param so you know when the plugin is available anyway, so this doesn't affect many people, but if I can repro it with your project I'll try to figure out what is causing it.

Show
Richard Bateman added a comment - May 17, 2012 19:50 I'm a bit behind on another project, so it may be a week or two before I can look at this, but I'll try to get to it before too long. As a side note, you nearly always want to use the onload param so you know when the plugin is available anyway, so this doesn't affect many people, but if I can repro it with your project I'll try to figure out what is causing it.
Hide
Permalink
Steve Yin added a comment - Jun 11, 2012 22:14

any update on this?

Show
Steve Yin added a comment - Jun 11, 2012 22:14 any update on this?
Hide
Permalink
Richard Bateman added a comment - Jun 11, 2012 23:43

Sorry, I still have not had a chance to look at it; I just finished moving (well, finished physically getting all our things into a new house) so my spare time has been extremely limited and I can't take work time to look at this. I would recommend that you set some breakpoints in FBControl.h and see if you can identify places where the startup lifecycle is different; that is what I would do. Pay particular attention to Load (https://github.com/firebreath/FireBreath/blob/master/src/ActiveXCore/FBControl.h#L411) and InitNew (https://github.com/firebreath/FireBreath/blob/master/src/ActiveXCore/FBControl.h#L375) which comprise the only places that I know of where the load should be different without params.

Let me know what you find.

Show
Richard Bateman added a comment - Jun 11, 2012 23:43 Sorry, I still have not had a chance to look at it; I just finished moving (well, finished physically getting all our things into a new house) so my spare time has been extremely limited and I can't take work time to look at this. I would recommend that you set some breakpoints in FBControl.h and see if you can identify places where the startup lifecycle is different; that is what I would do. Pay particular attention to Load (https://github.com/firebreath/FireBreath/blob/master/src/ActiveXCore/FBControl.h#L411) and InitNew (https://github.com/firebreath/FireBreath/blob/master/src/ActiveXCore/FBControl.h#L375) which comprise the only places that I know of where the load should be different without params. Let me know what you find.
Hide
Permalink
doug mansell added a comment - Jun 20, 2012 08:36

Note "community additions" section of this page: (someone else has noticed this same strangeness with object activation) http://msdn.microsoft.com/en-us/library/ie/ms535880(v=vs.85).aspx

Show
doug mansell added a comment - Jun 20, 2012 08:36 Note "community additions" section of this page: (someone else has noticed this same strangeness with object activation) http://msdn.microsoft.com/en-us/library/ie/ms535880(v=vs.85).aspx
Hide
Permalink
doug mansell added a comment - Jun 21, 2012 07:47

Thanks for the test project Steve. Try this fix: https://github.com/dougma/FireBreath/compare/FB-177

Show
doug mansell added a comment - Jun 21, 2012 07:47 Thanks for the test project Steve. Try this fix: https://github.com/dougma/FireBreath/compare/FB-177
Hide
Permalink
Steve Yin added a comment - Jun 26, 2012 22:03

thanks, the problem has been fixed.

Show
Steve Yin added a comment - Jun 26, 2012 22:03 thanks, the problem has been fixed.
Hide
Permalink
Steve Yin added a comment - Jul 2, 2012 20:47

well, problem is not fixed, if there is no param tag, then FBControl::InitNew and Load function will never be called because the no param tag cause the IPersistPropertyBag thinks there is no property, so setReady will never be called, then JSAPI will fail, because setReady sets the host of JSAPI.

So I added a setReady() call in last line of InPlaceActivate, it seems good so far. but I'm not sure it's the right way to solve this.

Show
Steve Yin added a comment - Jul 2, 2012 20:47 well, problem is not fixed, if there is no param tag, then FBControl::InitNew and Load function will never be called because the no param tag cause the IPersistPropertyBag thinks there is no property, so setReady will never be called, then JSAPI will fail, because setReady sets the host of JSAPI. So I added a setReady() call in last line of InPlaceActivate, it seems good so far. but I'm not sure it's the right way to solve this.
Hide
Permalink
Richard Bateman added a comment - Jul 2, 2012 23:37

Hmm; this is really strange. That is a definite divergence from how it used to work; it used to be that InitNew would get called if no properties were present.

This may take a bit more thinking on how to address properly. :-/

Show
Richard Bateman added a comment - Jul 2, 2012 23:37 Hmm; this is really strange. That is a definite divergence from how it used to work; it used to be that InitNew would get called if no properties were present. This may take a bit more thinking on how to address properly. :-/
Hide
Permalink
doug mansell added a comment - Jul 3, 2012 07:50

test page with two plugins side by side; one with param element, one without.

Show
doug mansell added a comment - Jul 3, 2012 07:50 test page with two plugins side by side; one with param element, one without.
Hide
Permalink
doug mansell added a comment - Jul 3, 2012 07:53

wowzer... i didn't test that very well did I? I wonder if I was testing with Firefox?!

Steve's on the right track; i've moved setReady from InitNew/Load to InPlaceActivate and it tests out ok with my test page (attached to this issue now).

Show
doug mansell added a comment - Jul 3, 2012 07:53 wowzer... i didn't test that very well did I? I wonder if I was testing with Firefox?! Steve's on the right track; i've moved setReady from InitNew/Load to InPlaceActivate and it tests out ok with my test page (attached to this issue now).
Hide
Permalink
Steve Yin added a comment - Jul 4, 2012 02:27

well, this would really fix this problem, but one problem is that InPlaceActive seems will be called multiple times during the initialization and running, so should we create a member variable to mark ready has been set?

But, call setReady multiple times won't cause any problem, because JSAPI and host won't change during the life of the plugin.

Show
Steve Yin added a comment - Jul 4, 2012 02:27 well, this would really fix this problem, but one problem is that InPlaceActive seems will be called multiple times during the initialization and running, so should we create a member variable to mark ready has been set? But, call setReady multiple times won't cause any problem, because JSAPI and host won't change during the life of the plugin.
Hide
Permalink
Steve Yin added a comment - Jul 4, 2012 21:10

sorry, InPlaceActive will only called once, after all initialize completed, so move setReady to InPlaceActive will be the final solution for this.

Show
Steve Yin added a comment - Jul 4, 2012 21:10 sorry, InPlaceActive will only called once, after all initialize completed, so move setReady to InPlaceActive will be the final solution for this.
Hide
Permalink
Richard Bateman added a comment - Jul 4, 2012 22:38

Unfortunately, that is not the case. InPlaceActivate can be called multiple times, just not without InPlaceDeactivate being called between each call. It's a definite edge case, but one we need to support without crashing.

Show
Richard Bateman added a comment - Jul 4, 2012 22:38 Unfortunately, that is not the case. InPlaceActivate can be called multiple times, just not without InPlaceDeactivate being called between each call. It's a definite edge case, but one we need to support without crashing.
Hide
Permalink
Steve Yin added a comment - Aug 1, 2012 19:42 - edited

and this related to another problem, if there is no <param> tag, plugin should parse the <object> tag's attributes to set plugin param. this is the code to parse the <object> tag, and this should be placed after SetClientSite:

// parse attributes in <object> tag as parameters
    FB::VariantMap paramMap;

    CComQIPtr<IOleControlSite> site(pClientSite);

    // if already setReady, then skip
    if(site == 0 || m_setReadyDone) return S_OK;

    CComPtr<IDispatch> dispach, attr_disp;
    site->GetExtendedControl(&dispach);

    // getting attributes of <object> tag
    CComQIPtr<IHTMLElement2> htmlElement(dispach);
    CComQIPtr<IHTMLDOMNode> domNode(htmlElement);

    domNode->get_attributes(&attr_disp);
    CComQIPtr<IHTMLAttributeCollection> attributs(attr_disp);

    long count;
    attributs->get_length(&count);
    VARIANT vIndex;
    vIndex.vt = VT_I4;
    VARIANT_BOOL vbSpecified;
    for(long i=0; i<count; i++)
    {
        CComPtr<IDispatch> item_disp;
        vIndex.lVal = i;
        hr = attributs->item(&vIndex, &item_disp);
        if(hr != S_OK || item_disp == 0)
            continue;

        CComQIPtr<IHTMLDOMAttribute> attr_item(item_disp);
        hr = attr_item->get_specified(&vbSpecified);

        // many of attributes will be not specified
        // only process specified attributes
        if(hr != S_OK || vbSpecified == VARIANT_FALSE)
            continue;

        CComBSTR name;
        CComVariant value;
        attr_item->get_nodeName(&name);
        attr_item->get_nodeValue(&value);

        if(value.vt == VT_NULL || value.pbstrVal == 0)
            continue;

        FB::variant varval(m_host->getVariant(&value));
        paramMap[FB::wstring_to_utf8(name.m_str)] = varval;
    }

    pluginMain->setParams(paramMap);
Show
Steve Yin added a comment - Aug 1, 2012 19:42 - edited and this related to another problem, if there is no <param> tag, plugin should parse the <object> tag's attributes to set plugin param. this is the code to parse the <object> tag, and this should be placed after SetClientSite:
// parse attributes in <object> tag as parameters
    FB::VariantMap paramMap;

    CComQIPtr<IOleControlSite> site(pClientSite);

    // if already setReady, then skip
    if(site == 0 || m_setReadyDone) return S_OK;

    CComPtr<IDispatch> dispach, attr_disp;
    site->GetExtendedControl(&dispach);

    // getting attributes of <object> tag
    CComQIPtr<IHTMLElement2> htmlElement(dispach);
    CComQIPtr<IHTMLDOMNode> domNode(htmlElement);

    domNode->get_attributes(&attr_disp);
    CComQIPtr<IHTMLAttributeCollection> attributs(attr_disp);

    long count;
    attributs->get_length(&count);
    VARIANT vIndex;
    vIndex.vt = VT_I4;
    VARIANT_BOOL vbSpecified;
    for(long i=0; i<count; i++)
    {
        CComPtr<IDispatch> item_disp;
        vIndex.lVal = i;
        hr = attributs->item(&vIndex, &item_disp);
        if(hr != S_OK || item_disp == 0)
            continue;

        CComQIPtr<IHTMLDOMAttribute> attr_item(item_disp);
        hr = attr_item->get_specified(&vbSpecified);

        // many of attributes will be not specified
        // only process specified attributes
        if(hr != S_OK || vbSpecified == VARIANT_FALSE)
            continue;

        CComBSTR name;
        CComVariant value;
        attr_item->get_nodeName(&name);
        attr_item->get_nodeValue(&value);

        if(value.vt == VT_NULL || value.pbstrVal == 0)
            continue;

        FB::variant varval(m_host->getVariant(&value));
        paramMap[FB::wstring_to_utf8(name.m_str)] = varval;
    }

    pluginMain->setParams(paramMap);
Hide
Permalink
Richard Bateman added a comment - Aug 2, 2012 00:36

hmm; that's definitely an interesting idea. Do you get those params on npapi browsers automatically? I can't remember offhand. I'd welcome a pull request where this was already done so I could easily look at what you propose.

Show
Richard Bateman added a comment - Aug 2, 2012 00:36 hmm; that's definitely an interesting idea. Do you get those params on npapi browsers automatically? I can't remember offhand. I'd welcome a pull request where this was already done so I could easily look at what you propose.
Hide
Permalink
Steve Yin added a comment - Aug 2, 2012 03:46

yes, under npapi, NPP_New will parse the <object> tag and send all attributs AND <param> tag's value through argn, argv.

But under IE, IE will not parse the attributes in <object> tag then won't parse these attributes to control.

Show
Steve Yin added a comment - Aug 2, 2012 03:46 yes, under npapi, NPP_New will parse the <object> tag and send all attributs AND <param> tag's value through argn, argv. But under IE, IE will not parse the attributes in <object> tag then won't parse these attributes to control.
Hide
Permalink
Richard Bateman added a comment - Oct 29, 2012 14:49

finally getting to look at this; it seems like a good idea. I'm closing the issue because the actual issue is fixed, but I'd love to see this resubmitted as an improvement request.

Show
Richard Bateman added a comment - Oct 29, 2012 14:49 finally getting to look at this; it seems like a good idea. I'm closing the issue because the actual issue is fixed, but I'd love to see this resubmitted as an improvement request.
Hide
Permalink
Richard Bateman added a comment - Oct 29, 2012 15:15

I believe this is now fixed.

Show
Richard Bateman added a comment - Oct 29, 2012 15:15 I believe this is now fixed.

People

  • Assignee:
    Richard Bateman
    Reporter:
    Steve Yin
Vote (0)
Watch (3)

Dates

  • Created:
    May 17, 2012 04:34
    Updated:
    Dec 13, 2012 19:41
    Resolved:
    Oct 29, 2012 15:15
  • Atlassian JIRA (v5.0.6#733-sha1:f48fab7)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for FireBreath. Try JIRA - bug tracking software for your team.