FireBreath Core
  1. FireBreath Core
  2. FIREBREATH-177

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

    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.

      1. FBControl.htm
        2 kB
        doug mansell
      2. projects.rar
        342 kB
        Steve Yin

        Issue Links

          Activity

          Hide
          Steve Yin added a comment - - 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 - - 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
          Richard Bateman added a comment -

          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 - 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
          Steve Yin added a comment -

          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 - 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
          Richard Bateman added a comment -

          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 - 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
          Richard Bateman added a comment -

          I believe this is now fixed.

          Show
          Richard Bateman added a comment - I believe this is now fixed.

            People

            • Assignee:
              Richard Bateman
              Reporter:
              Steve Yin
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: