Closed Bug 297665 Opened 20 years ago Closed 19 years ago

Incompatibility check is not performed when downgrading from 1.0+ to 1.0

Categories

(Toolkit :: Add-ons Manager, defect)

1.7 Branch
x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: mgueury, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050527 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050527 Firefox/1.0+

It is the detail of bug 295950. Problem 4 with a step-by-step testcase.

This problem is about upgrade of an extension and then downgrade of Firefox.
Causing a error at startup:

XPCOM:EventReceiver:firefox.exe - Entry Point Not Found
The procedure entry point NS_Alloc could not be located in the dynamic library
xpcom.dll


Reproducible: Always

Steps to Reproduce:
0. Have Firefox 1.0.4 and Firefox 1.0+ (1.1 beta) installed on your machine
1. Make sure that the both works fine and that the HTML Validator extension
   is not installed. 
   -> check that the extension in not in 1.0 
   -> check that the extension in not in 1.1
2. In 1.0, install the extension for 1.0 (maxversion=0.8) (minversion=1.0)
   I can not upload the files there are too big. So, here is a link where
   you can find them.

   > http://users.skynet.be/mgueury/mozilla/download.html

   And a direct link to the XPI
   > http://htmlvalidator.sourceforge.net/mozilla/tidy_firefox_win_060.xpi 
   (min 0.8/max 1.0)

3. When the extension is installed, restart Firefox 1.0. It works fine.
4. Stop Firefox 1.0, start 1.1.
5. Install the extension for 1.1.
   > http://htmlvalidator.sourceforge.net/mozilla/tidy_firefox_11_win_060.xpi
   (min 1.0+/max 1.0+)

6. When the extension is installed, restart Firefox 1.1. It works fine.
7. Stop Firefox 1.1 and restart firefox 1.0

XPCOM:EventReceiver:firefox.exe - Entry Point Not Found
The procedure entry point NS_Alloc could not be located in the dynamic library
xpcom.dll



Actual Results:  
An error

Expected Results:  
The extension should be disabled
This occurs when downgrading from 1.0+ to 1.0 in that an incompatibility check
is not performed and extensions. This doesn't appear to affect 1.0+ - only 1.0
after downgrading from 1.0+

The "error NS_Alloc" from the original summary I believe is due to using an
unfrozen interface and is to be expected when using interfaces that haven't been
frozen.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Upgrade of an extension to 1.1: error NS_Alloc when going back to 1.0 → Incompatibility check is not performed when downgrading from 1.0+ to 1.0
Version: unspecified → 1.0 Branch
Note: using the new capabilities provided by bug 253742 you may be able to work
around the NS_Alloc error.
I have found some idea about the cause of this

1) My XPCOM class is declared like this in the IDL file

[...]
interface nsITidy : nsISupports
{
[...]

What translate in the class definition of the implementation to 

[...]
class nsTidyImpl : public nsITidy
{
public:
    nsTidyImpl();

    NS_DECL_ISUPPORTS
    NS_DECL_NSITIDY
[...]

2) In the C class implementation I use this macro to define the ISUPORT 
   interface:
[...]
NS_IMPL_ISUPPORTS1_CI(nsTidyImpl, nsITidy)
[...]

This macro is define in nsSupportImpl.h like this:

[...]
#define MY_NS_IMPL_ISUPPORTS1_CI(_class, _interface)       \
  MY_NS_IMPL_ADDREF(_class)                                \
  NS_IMPL_RELEASE(_class)                                  \
  NS_IMPL_QUERY_INTERFACE1_CI(_class, _interface)          \
  NS_IMPL_CI_INTERFACE_GETTER1(_class, _interface)
[...]

The NS_IMPL_CI_INTERFACE_GETTER1 is defined as :

[...]
#define NS_IMPL_CI_INTERFACE_GETTER1(_class, _interface)     \
   NS_CLASSINFO_HELPER_BEGIN(_class, 1)                      \
     NS_CLASSINFO_HELPER_ENTRY(0, _interface)                \
   NS_CLASSINFO_HELPER_END
[...]

The definition below contains the code to the unfrozen API. But it is 
not contained in my code. Simply in NS_IMPL_ISUPPORTS1_CI

[...]
#define NS_CLASSINFO_HELPER_BEGIN(_class, _c)                                 \
NS_IMETHODIMP                                                                 \
NS_CI_INTERFACE_GETTER_NAME(_class)(PRUint32 *count, nsIID ***array)          \
{                                                                             \
    *count = _c;                                                              \
    *array = (nsIID **)nsMemory::Alloc(sizeof (nsIID *) * _c);

#define NS_CLASSINFO_HELPER_ENTRY(_i, _interface)                             \
    (*array)[_i] = (nsIID *)nsMemory::Clone(&NS_GET_IID(_interface),          \
                                            sizeof(nsIID));

#define NS_CLASSINFO_HELPER_END                                               \
    return NS_OK;                                                             \
}
[...]

Please notice the call to nsMemory::Clone and nsMemory:Alloc
nsMemory::Close and nsMemory::Alloc are symbols provided by the xpcom glue. If
you are linking against xpcomglue_s.lib you should not have this problem.
:)

That was it. Just a small xpcomglue lib that was not linked with the .DLL/.SO.
Now the 1.0 library works in 1.1 too. And it solves all my 1.1 concerns.
I tested on Windows and Linux with success.

Thanks a lot !

Marc
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → INVALID
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.