Closed Bug 1680269 Opened 3 years ago Closed 3 years ago

ScriptLoadHandler.cpp:354:7: error: ‘MakeScopeExit’ was not declared in this scope

Categories

(Core :: DOM: Core & HTML, task, P3)

task

Tracking

()

RESOLVED FIXED
85 Branch
Tracking Status
firefox85 --- fixed

People

(Reporter: petr.sumbera, Assigned: sg)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0

Steps to reproduce:

I see following build error:

 9:01.09 /builds/psumbera/FIREFOX/dom/script/ScriptLoadHandler.cpp:354:7: error: ‘MakeScopeExit’ was not declared in this scope
 9:01.09   354 |       MakeScopeExit([&] { mRequest->NotifyStop(channelRequest, rv); });
 9:01.09       |       ^~~~~~~~~~~~~

The issue was introduced via:

changeset: 558351:c15be3f69741
user: Simon Giesecke <sgiesecke@mozilla.com>
date: Mon Nov 23 17:06:52 2020 +0100
description:
Bug 1673424 - Fix includes around JS/StructuredClone.h.

    Differential Revision: https://phabricator.services.mozilla.com/D94762

    Depends on D93568
Regressed by: 1673424
Has Regression Range: --- → yes
Keywords: regression
Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Type: defect → task

dom/script/ScriptLoadHandler.cpp is mssing an include for mozilla/ScopeExit.h.

Assignee: nobody → sgiesecke

There is probably one more occurance:

24:20.09 /builds/psumbera/FIREFOX/parser/html/nsHtml5StreamParser.cpp: In member function ‘nsresult nsHtml5StreamParser::OnStartRequest(nsIRequest*)’:
24:20.09 /builds/psumbera/FIREFOX/parser/html/nsHtml5StreamParser.cpp:979:26: error: ‘MakeScopeExit’ was not declared in this scope
24:20.09   979 |   auto detectorCreator = MakeScopeExit([&] {
24:20.09       |                          ^~~~~~~~~~~~~

Could you set priority and severity for this?

Flags: needinfo?(sgiesecke)
Severity: -- → S3
Flags: needinfo?(sgiesecke)
Priority: -- → P3

I provided fixes for this. I just wonder, are you on a special platform or building with a special mozconfig?

Flags: needinfo?(petr.sumbera)

I'm on Solaris building with GCC and with following mozconfig:

ac_add_options --with-system-icu
ac_add_options --with-system-libevent
ac_add_options --with-system-zlib
ac_add_options --enable-js-shell
ac_add_options --prefix=/opt/firefox
ac_add_options --enable-jemalloc
ac_add_options --enable-replace-malloc
ac_add_options --enable-pulseaudio
ac_add_options --enable-debug
ac_add_options --disable-install-strip
# use gcc (not clang)
ac_add_options --enable-release
ac_add_options --enable-debug-symbols
ac_add_options --disable-install-strip
ac_add_options --disable-optimize
ac_add_options --disable-geckodriver
# https://bugzilla.mozilla.org/show_bug.cgi?id=1547217
ac_add_options --disable-verify-mar
# no nasm on intel yet
ac_add_options --disable-av1

BTW there are some other issues I'm trying to bisect.

It points me now to:

The first bad revision is:
changeset: 558367:9d62f7474851
user: Simon Giesecke <sgiesecke@mozilla.com>
date: Mon Nov 23 17:09:22 2020 +0100
description:
Bug 1673931 - Remove unused includes from Timeout.h.

    Differential Revision: https://phabricator.services.mozilla.com/D96541

    Depends on D96540

Where on the way I have encountered following issues:

#1:

 1:53.42 /builds/psumbera/FIREFOX/docshell/base/nsDocShellTreeOwner.cpp: In static member function ‘static void ChromeTooltipListener::sTooltipCallback(nsITimer*, void*)’:
 1:53.42 /builds/psumbera/FIREFOX/docshell/base/nsDocShellTreeOwner.cpp:1242:20: error: ‘MakeScopeExit’ was not declared in this scope
 1:53.42  1242 |     auto cleanup = MakeScopeExit([&] { self->mPossibleTooltipNode = nullptr; });
 1:53.42       |                    ^~~~~~~~~~~~~

#2:

 3:49.89                  from /builds/psumbera/FIREFOX/dom/base/nsGlobalWindowInner.cpp:45:
 3:49.89 /builds/psumbera/FIREFOX/obj-x86_64-pc-solaris2.11/dist/include/mozilla/BaseProfilerDetail.h:17:4: error: #error Do not #include this header when MOZ_GECKO_PROFILER is not #defined.
 3:49.89    17 | #  error Do not #include this header when MOZ_GECKO_PROFILER is not #defined.
 3:49.89       |    ^~~~~

#3:

 2:23.22 /builds/psumbera/FIREFOX/accessible/base/NotificationController.cpp: In member function ‘virtual void mozilla::a11y::NotificationController::WillRefresh(mozilla::TimeStamp)’:
 2:23.22 /builds/psumbera/FIREFOX/accessible/base/NotificationController.cpp:597:62: error: ‘OTHER’ was not declared in this scope
 2:23.22   597 |   AUTO_PROFILER_LABEL("NotificationController::WillRefresh", OTHER);
 2:23.22       |                                                              ^~~~~

Not sure wheter all are related to the change. I'm investigating now...

Flags: needinfo?(petr.sumbera)

Ah ok, that explains why this hasn't shown up in CI.

I don't think it's worth bisecting this. These kinds of issues are due to missing include directives, for which the root cause in not in the patches that you find by bisecting, but rather in many cases years ago. It was just building before, because those files were implicitly relying on these things being included.

The MOZ_GECKO_PROFILER profiler issues already have patches in Bug 1679272 and 1679273.

Depends on: 1679272, 1679273

I think now all of this is a duplicate of these bugs.

Fwiw i have a similar failure on OpenBSD which doesnt have MOZ_GECKO_PROFILER:

20:20.69 /home/landry/src/m-c/docshell/base/nsDocShell.cpp:759:7: error: use of undeclared identifier 'MakeScopeExit'                                                                                                
20:20.69       MakeScopeExit([&]() { mIsNavigating = oldIsNavigating; });                                                                                                                                            
20:20.69       ^                                                                                                                                                                                                     
20:20.82 BUILDSTATUS BUILD_VERBOSE config/external/icu/common                                                                                                                                                        
20:21.23 /home/landry/src/m-c/docshell/base/nsDocShell.cpp:3291:30: error: use of undeclared identifier 'MakeScopeExit'                                                                                              
20:21.23   auto cleanupIsNavigating = MakeScopeExit([&]() { mIsNavigating = false; });                                                                                                                               
20:21.23                              ^                                                                                                                                                                              
20:21.36 /home/landry/src/m-c/docshell/base/nsDocShell.cpp:3307:30: error: use of undeclared identifier 'MakeScopeExit'                                                                                              
20:21.36   auto cleanupIsNavigating = MakeScopeExit([&]() { mIsNavigating = false; });                                                                                                                               
20:21.36                              ^                                                                                                                                                                              
20:21.50 /home/landry/src/m-c/docshell/base/nsDocShell.cpp:3325:30: error: use of undeclared identifier 'MakeScopeExit'                                                                                              
20:21.50   auto cleanupIsNavigating = MakeScopeExit([&]() { mIsNavigating = false; });                                                                                                                               
20:21.50                              ^                                                                                                                                                                              
20:21.62 BUILDSTATUS BUILD_VERBOSE config/external/icu/i18n                                                                                                                                                          
20:22.29 /home/landry/src/m-c/docshell/base/nsDocShell.cpp:10367:7: error: use of undeclared identifier 'MakeScopeExit'                                                                                              
20:22.29       MakeScopeExit([&] { mInitialClientSource.reset(); });                                                                                                                                                 
20:22.29       ^                                                                                                                                                                                                     
20:22.44 /home/landry/src/m-c/docshell/base/nsDocShell.cpp:10425:7: error: use of undeclared identifier 'MakeScopeExit'
20:22.44       MakeScopeExit([&] { mInitialClientSource.reset(); });
20:22.44       ^                                                                                          
20:23.86 In file included from Unified_cpp_docshell_base1.cpp:2:                                                                                                                                                     
20:23.86 /home/landry/src/m-c/docshell/base/nsDocShellTreeOwner.cpp:1242:20: error: use of undeclared identifier 'MakeScopeExit'
20:23.86     auto cleanup = MakeScopeExit([&] { self->mPossibleTooltipNode = nullptr; });
20:23.86                    ^                                                                

filed another bug for a (maybe different) failure in bug #1680772.

i've applied D98576 D98492 & D97966 from this bug and bug #1679273 and im still seeing the build failure above.

i had some fuzz applying it to dom/serviceworkers/ServiceWorkerRegistrationProxy.cpp which had no include for "mozilla/ScopeExit.h" so i added it above #include "mozilla/ipc/BackgroundParent.h"``

added this to the mix:

--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -28,16 +28,17 @@
 #include "mozilla/LoadInfo.h"
 #include "mozilla/Logging.h"
 #include "mozilla/MediaFeatureChange.h"
 #include "mozilla/ObservedDocShell.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/PresShell.h"
 #include "mozilla/ResultExtensions.h"
 #include "mozilla/SchedulerGroup.h"
+#include "mozilla/ScopeExit.h"
 #include "mozilla/ScrollTypes.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPrefs_browser.h"
 #include "mozilla/StaticPrefs_dom.h"
 #include "mozilla/StaticPrefs_extensions.h"
 #include "mozilla/StaticPrefs_privacy.h"
 #include "mozilla/StaticPrefs_security.h"
 #include "mozilla/StaticPrefs_ui.h"

but that wasnt enough, it seems more similar includes are needed here and there ?

 0:41.36 /home/landry/src/m-c/docshell/base/nsDocShellTreeOwner.cpp:1242:20: error: use of undeclared identifier 'MakeScopeExit'
 0:41.36     auto cleanup = MakeScopeExit([&] { self->mPossibleTooltipNode = nullptr; });
 0:41.36                    ^
 0:44.03 1 error generated.
 0:44.42 gmake[4]: *** [/home/landry/src/m-c/config/rules.mk:676 : Unified_cpp_docshell_base1.o] Erreur 1
 0:44.42 gmake[4]: *** Attente des t_ches non termin_es....
 0:44.52 dom/cache
 0:47.67 In file included from Unified_cpp_dom_bindings0.cpp:2:
 0:47.68 /home/landry/src/m-c/dom/bindings/BindingUtils.cpp:3696:7: error: use of undeclared identifier 'MakeScopeExit'
 0:47.68       MakeScopeExit([&]() { Unused << rv.MaybeSetPendingException(aCx); });
 0:47.68       ^
 0:49.28 In file included from Unified_cpp_dom_base0.cpp:56:
 0:49.28 /home/landry/src/m-c/dom/base/BodyConsumer.cpp:639:28: error: no member named 'MakeScopeExit' in namespace 'mozilla'
 0:49.28   auto autoFree = mozilla::MakeScopeExit([&] { free(aResult); });
 0:49.28                   ~~~~~~~~~^
 0:49.38 /home/landry/src/m-c/dom/base/BodyConsumer.cpp:651:16: error: no member named 'MakeScopeExit' in namespace 'mozilla'
 0:49.38       mozilla::MakeScopeExit([self] { self->ReleaseObject(); });
 0:49.38       ~~~~~~~~~^
 0:49.88 In file included from Unified_cpp_dom_base0.cpp:65:
 0:49.88 /home/landry/src/m-c/dom/base/BodyStream.cpp:98:18: error: use of undeclared identifier 'MakeScopeExit'
 0:49.88   auto cleanup = MakeScopeExit([stream] { stream->Close(); });
 0:49.88                  ^
 0:50.12 1 error generated.
 0:50.54 gmake[4]: *** [/home/landry/src/m-c/config/rules.mk:676 : Unified_cpp_dom_bindings0.o] Erreur 1
 0:50.55 gmake[3]: *** [/home/landry/src/m-c/config/recurse.mk:72 : dom/bindings/target-objects] Erreur 2
 0:50.55 gmake[3]: *** Attente des t_ches non termin_es....
 0:53.19     Finished release [optimized] target(s) in 37.60s
 0:55.12     Finished release [optimized] target(s) in 39.32s
 0:56.15 In file included from Unified_cpp_dom_base0.cpp:137:
 0:56.15 /home/landry/src/m-c/dom/base/ChromeUtils.cpp:305:18: error: use of undeclared identifier 'MakeScopeExit'
 0:56.16   auto cleanup = MakeScopeExit([&]() { aRv.NoteJSContextException(cx); });
 0:56.16                  ^
 0:56.29 BUILDSTATUS BUILD_VERBOSE dom/cache
 0:56.62 /home/landry/src/m-c/dom/base/ChromeUtils.cpp:1174:18: error: use of undeclared identifier 'MakeScopeExit'
 0:56.62   auto cleanup = MakeScopeExit([&]() { aRv.NoteJSContextException(cx); });

the more includes i add, the more failure are shown, so something is wrong somewhere.

 1:15.41 In file included from Unified_cpp_dom_canvas4.cpp:128:
 1:15.41 /home/landry/src/m-c/dom/canvas/WebGLTexture.cpp:594:25: error: use of undeclared identifier 'MakeScopeExit'
 1:15.42     const auto revert = MakeScopeExit(
 1:15.42                         ^
 1:15.51 /home/landry/src/m-c/dom/canvas/WebGLTexture.cpp:639:7: error: use of undeclared identifier 'MakeScopeExit'
 1:15.51       MakeScopeExit([&]() { gl->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, 4); });
 1:15.51       ^
 1:17.85 In file included from Unified_cpp_dom_canvas4.cpp:137:
 1:17.85 /home/landry/src/m-c/dom/canvas/WebGLTextureUpload.cpp:1016:32: error: use of undeclared identifier 'MakeScopeExit'
 1:17.85   const auto revertUnpacking = MakeScopeExit([&]() {
 1:17.85                                ^
 1:17.98 /home/landry/src/m-c/dom/canvas/WebGLTextureUpload.cpp:1661:27: error: use of undeclared identifier 'MakeScopeExit'
 1:17.98       const auto revert = MakeScopeExit(
 1:17.98                           ^

(In reply to Landry Breuil (:gaston) from comment #12)

the more includes i add, the more failure are shown, so something is wrong somewhere.

 1:15.41 In file included from Unified_cpp_dom_canvas4.cpp:128:
 1:15.41 /home/landry/src/m-c/dom/canvas/WebGLTexture.cpp:594:25: error: use of undeclared identifier 'MakeScopeExit'
 1:15.42     const auto revert = MakeScopeExit(
 1:15.42                         ^
 1:15.51 /home/landry/src/m-c/dom/canvas/WebGLTexture.cpp:639:7: error: use of undeclared identifier 'MakeScopeExit'
 1:15.51       MakeScopeExit([&]() { gl->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, 4); });
 1:15.51       ^
 1:17.85 In file included from Unified_cpp_dom_canvas4.cpp:137:
 1:17.85 /home/landry/src/m-c/dom/canvas/WebGLTextureUpload.cpp:1016:32: error: use of undeclared identifier 'MakeScopeExit'
 1:17.85   const auto revertUnpacking = MakeScopeExit([&]() {
 1:17.85                                ^
 1:17.98 /home/landry/src/m-c/dom/canvas/WebGLTextureUpload.cpp:1661:27: error: use of undeclared identifier 'MakeScopeExit'
 1:17.98       const auto revert = MakeScopeExit(
 1:17.98                           ^

I updated the patch stack, and hopefully fixed all files that use MakeScopeExit now. Can you try it using the updated patches again?

Flags: needinfo?(landry)

well, the patch stack doesnt apply on top of m-c it seems, updated to tip and i get this (when applying the raw diffs downloaded from phabricator and applying with patch -C -p1) list of failling chunks :

Patching file dom/script/ScriptLoadHandler.cpp using Plan A...
Hunk #1 failed at 5.
1 out of 1 hunks failed
Patching file parser/html/nsHtml5StreamParser.cpp using Plan A...
Hunk #1 failed at 6.
1 out of 1 hunks failed
Patching file dom/serviceworkers/ServiceWorkerRegistrationProxy.cpp using Plan A...
Hunk #1 failed at 7.                                                                                                   
1 out of 1 hunks failed   
Flags: needinfo?(landry)

i see https://lando.services.mozilla.com/D98576/ but i have zero idea how to get 'regular patches' to apply from that. all this lando/phabricator contraption is just wayyys too complicated for external contributors, sorry. i really regret the 'attach patch to bug in bugzilla' days..

I do have similar issue to apply patches:

ulx-0 12:09 /builds/psumbera/FIREFOX: gpatch -p1 < D98492.diff
patching file dom/script/ScriptLoadHandler.h
patching file dom/script/ScriptLoadHandler.cpp
Hunk #1 FAILED at 5.
1 out of 1 hunk FAILED -- saving rejects to file dom/script/ScriptLoadHandler.cpp.rej
ulx-0 12:09 /builds/psumbera/FIREFOX: gpatch -p1 < D98576.diff
patching file parser/html/nsHtml5MetaScanner.h
patching file parser/html/nsHtml5StreamParser.h
patching file parser/html/nsHtml5StreamParser.cpp
Hunk #1 FAILED at 6.
1 out of 1 hunk FAILED -- saving rejects to file parser/html/nsHtml5StreamParser.cpp.rej

The only way I used to do this is using moz-phab, in this case I would do moz-phab patch D98576. moz-phab requires a one-time setup as described here: https://moz-conduit.readthedocs.io/en/latest/phabricator-user.html#setting-up-mozphab

I am not an expert on this though. I think https://chat.mozilla.org/#/room/#conduit:mozilla.org should be the best place to find support.

(I would expect the patches to apply cleanly, since I just updated all of them.)

$pip3.8  install --user MozPhab 
Collecting MozPhab
  Downloading MozPhab-0.1.93.tar.gz (75 kB)
     |________________________________| 75 kB 242 kB/s 
Collecting distro
  Downloading distro-1.5.0-py2.py3-none-any.whl (18 kB)
Collecting glean-sdk==33.0.4
  Downloading glean-sdk-33.0.4.tar.gz (1.3 MB)
     |________________________________| 1.3 MB 1.3 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uwjitp1t/glean-sdk/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uwjitp1t/glean-sdk/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-fxq2nzf6
         cwd: /tmp/pip-install-uwjitp1t/glean-sdk/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-uwjitp1t/glean-sdk/setup.py", line 16, in <module>
        from setup import *
      File "/tmp/pip-install-uwjitp1t/glean-sdk/glean-core/python/setup.py", line 82, in <module>
        raise ValueError(f"The platform {sys.platform} is not supported.")
    ValueError: The platform openbsd6 is not supported.

how.. surprising.

Hm, that's unfortunate. It doesn't seem to me that glean would be strictly required by moz-phab. Could you raise that in the conduit channel, or in a separate Bug targeting the moz-phab component?

For the problem at hand, we can also just land the existing patches, and do another iteration if any problems remain.

Sorry, I didn't expect the tooling to be so problematic here.

reading bug #1660120 it seems moz-phab cant be installed on non-tier1 platforms.

if its simpler for you, then yes land whatever seems appropriate, and we'll grab the commits from m-c tip or whatever other repo lando pushes them.

Pushed by sgiesecke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cac542f1c567
Fix includes for ScriptLoadHandler. r=smaug
https://hg.mozilla.org/integration/autoland/rev/e024884814b2
Fix includes for nsHtml5StreamParser. r=hsivonen
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch

The patches are on central now, can you check if your build issues are solved?

Flags: needinfo?(petr.sumbera)
Flags: needinfo?(landry)

Just checking. With latest sources I still get the issue #3 I mentioned in https://bugzilla.mozilla.org/show_bug.cgi?id=1680269#c7 . Is it something not related I should create new bug?

Flags: needinfo?(sgiesecke)
Flags: needinfo?(petr.sumbera)

Yes, that's still related. Can you check if adding #include "GeckoProfiler.h" in that file fixes that? Does the build complete then?

Flags: needinfo?(sgiesecke)

There are more like this:

/builds/psumbera/FIREFOX/dom/base/WindowDestroyedEvent.cpp:52:52: error: ‘OTHER’ was not declared in this scope
/builds/psumbera/FIREFOX/dom/ipc/BrowserChild.cpp:2219:46: error: ‘OTHER’ was not declared in this scope
/builds/psumbera/FIREFOX/dom/ipc/BrowserParent.cpp:2044:46: error: ‘OTHER’ was not declared in this scope
/builds/psumbera/FIREFOX/dom/indexedDB/ActorsChild.cpp:504:55: error: ‘DOM’ was not declared in this scope

Unfortunatelly I'm not sure I will be able to find all as there is probably not related issue:

13:44.59 error: failed to run custom build command for `style v0.0.1 (/builds/psumbera/FIREFOX/servo/components/style)`
13:44.59 Caused by:
13:44.59   process didn't exit successfully: `/builds/psumbera/FIREFOX/obj-x86_64-pc-solaris2.11/debug/build/style-f5b219bfa353f0e8/build-script-build` (exit code: 101)

(which will be very hard to bisect now with this problem)

Hm, I think I can reproduce this now by manually disabling the profiler. I thought I had fixed those issues before, but maybe these have been newly introduced since. I will provide a patch.

With the newly proposed patch I see only unrelated issue (failed to run custom build command for `style v0.0.1). Wchich I now remember already seeing in past (so hopefully I will avoid it soon).

Thank you for working on this!

Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: FIXED → ---

with what was pushed to m-c and the raw diff from https://phabricator.services.mozilla.com/D99063 on top (and, unrelated to this bug but i also need patches/tweaks for bug #1674408 and bug #1674381) - i finally have a successful build like petr. thanks simon !

Flags: needinfo?(landry)
Pushed by sgiesecke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f36a292d76e7
Fix build when building without MOZ_GECKO_PROFILER. r=gerald

is the milestone correct for this bug ? afaik, the 'merge 85 from central to beta' already happened, so whatever was pushed in this bug lately might not be in beta (and would have to be backported to avoid hair loss)

(In reply to Landry Breuil (:gaston) from comment #33)

is the milestone correct for this bug ? afaik, the 'merge 85 from central to beta' already happened, so whatever was pushed in this bug lately might not be in beta (and would have to be backported to avoid hair loss)

No, that should be fine. Merge day is 2020-12-14.

(In reply to Simon Giesecke [:sg] [he/him] from comment #34)

(In reply to Landry Breuil (:gaston) from comment #33)

is the milestone correct for this bug ? afaik, the 'merge 85 from central to beta' already happened, so whatever was pushed in this bug lately might not be in beta (and would have to be backported to avoid hair loss)

No, that should be fine. Merge day is 2020-12-14.

thanks for the confirmation, wasnt sure there were other merges/pushes between branches during the rc period.

Status: REOPENED → RESOLVED
Closed: 3 years ago3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: