diff --git a/layout/html/tests/Makefile.in b/layout/html/tests/Makefile.in
index f07888370225..d131be896f8b 100644
--- a/layout/html/tests/Makefile.in
+++ b/layout/html/tests/Makefile.in
@@ -39,19 +39,6 @@ LIBS = \
$(PNG_LIBS) \
$(JPEG_LIBS) \
-l$(MOZ_LIB_UTIL_PREFIX)util \
- -lnetlib \
- -lfileurl \
- -lftpurl \
- -lgophurl \
- -lremoturl \
- -lnetcnvts \
- -labouturl \
- -lhttpurl \
- -lmimetype \
- -lpwcac \
- -lnetcache \
- -lsockstuburl \
- -lnetwork \
-lpref \
-lsecfree \
-l$(MOZ_LIB_JS_PREFIX)js \
@@ -70,6 +57,28 @@ LIBS = \
$(NSPR_LIBS) \
$(NULL)
+ifndef NECKO
+LIBS += \
+ -lpwcac \
+ -lfileurl \
+ -lftpurl \
+ -lgophurl \
+ -lremoturl \
+ -lnetcnvts \
+ -labouturl \
+ -lhttpurl \
+ -lmimetype \
+ -lnetcache \
+ -lnetlib \
+ -lnetwork \
+ -lsockstuburl \
+ $(NULL)
+else
+LIBS += \
+ -lneckoutil_s \
+ $(NULL)
+endif
+
include $(topsrcdir)/config/rules.mk
test: