[BUG] ERROR: method 'Target.enable' is not supported Firefox custom build.
See original GitHub issueContext:
Playwright Version: latest Operating System: Linux Extra: Custom Firefox linux build (works by hand)
Code Snippet
const playwright = require('playwright');
(async () => {
for (const browserType of ['firefox',]) {
const browser = await playwright[browserType].launch({
headless: false,
dumpio: true,
});
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('http://whatsmyuseragent.org/');
await page.screenshot({ path: `example-${browserType}.png` });
await browser.close();
}
})();
Describe the bug
My problem arises when using a custom Mozilla build but following playwright scripts and mozilla documentation. Address Sanitizer. File mozconfig by default is
# Combined .mozconfig file for ASan on Linux+Mac
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-asan
# Enable ASan specific code and build workarounds
ac_add_options --enable-address-sanitizer
# Add ASan to our compiler flags
export CFLAGS="-fsanitize=address -Dxmalloc=myxmalloc -fPIC"
export CXXFLAGS="-fsanitize=address -Dxmalloc=myxmalloc -fPIC"
# Additionally, we need the ASan flag during linking. Normally, our C/CXXFLAGS would
# be used during linking as well but there is at least one place in our build where
# our CFLAGS are not added during linking.
# Note: The use of this flag causes Clang to automatically link the ASan runtime :)
export LDFLAGS="-fsanitize=address"
# These three are required by ASan
ac_add_options --disable-jemalloc
ac_add_options --disable-crashreporter
ac_add_options --disable-elf-hack
# Keep symbols to symbolize ASan traces later
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug-symbols
ac_add_options --disable-install-strip
# Settings for an opt build (preferred)
# The -gline-tables-only ensures that all the necessary debug information for ASan
# is present, but the rest is stripped so the resulting binaries are smaller.
ac_add_options --enable-optimize="-O2 -gline-tables-only"
ac_add_options --disable-debug
# Settings for a debug+opt build
#ac_add_options --enable-optimize
#ac_add_options --enable-debug
# ASan specific options on Linux
ac_add_options --enable-valgrind
Build process as described Contributing Browser Patches
$ ./browser_patches/prepare_checkout.sh firefox checkout
$ ./path/checkout/mach bootstrap // to ensure satisfied dependencies.
$ ./browser_patches/firefox/build.sh
$ ./path/checkout/mach run // to ensure build works fine
$ ./browser_patches/firefox/archive.sh .. //saved zip and cp it to core path and replace original folder of firefox or defined by 'executablePath' in script.
Commented new build config to disable crash reporter …/local-firefox/linux-1029/firefox/playwright.cfg if not firefox shows a dialog at start “contact administrator…” (it is disabled in mozconfig “ac_add_options --disable-crashreporter” anyway)
//lockPref("toolkit.crashreporter.enabled", false);
..
//Components.classes["@mozilla.org/toolkit/crash-reporter;1"].getService(Components.interfaces.nsICrashReporter).submitReports = false;
Error if not commented in ‘dumpio’:
JavaScript error: playwright.cfg, line 235: TypeError: Components.classes['@mozilla.org/toolkit/crash-reporter;1'] is undefined
Firefox AddressSanitizer build is done, it works fine because I use it for my testsuite manually. But if I use it with the playwright script, opens Firefox and visually does nothing and throw this error :
1583842611731 addons.webextension.doh-rollout@mozilla.org WARN Loading extension 'doh-rollout@mozilla.org': Reading manifest: Invalid extension permission: networkStatus
1583842612448 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
1583842612448 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: telemetry
1583842612448 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
1583842612449 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: about:reader*
[2020-03-10T12:16:53Z ERROR audio_thread_priority::rt_linux] setrlimit64: 1
Juggler listening on ws://127.0.0.1:39135/74fcf71e-37f4-4a0c-b17d-69890b3676e4
(node:21256) UnhandledPromiseRejectionWarning: Error: Protocol error (Target.enable): ERROR: method 'Target.enable' is not supported _dispatch@chrome://juggler/content/protocol/Dispatcher.js:96:15
at Promise (/home/lupin/node_modules/playwright-core/lib/firefox/ffConnection.js:54:63)
at new Promise (<anonymous>)
at FFConnection.send (/home/lupin/node_modules/playwright-core/lib/firefox/ffConnection.js:53:16)
at Function.connect (/home/lupin/node_modules/playwright-core/lib/firefox/ffBrowser.js:49:26)
at Firefox.launch (/home/lupin/node_modules/playwright-core/lib/server/firefox.js:54:53)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:21256) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:21256) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
This part t’s not important, same line with default playwright firefox build and works fine with script attached
[2020-03-10T12:16:53Z ERROR audio_thread_priority::rt_linux] setrlimit64: 1 it’s not important, same line with default playwright firefox build and works fine with script attached) Any help to locate and fix this issue? I use Firefox with Address Sanitizer to commit fixes and ensure no memory corruptions are introduced.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
It has been building for 40 minutes, so I have not replied before. I close it and open it if it doesn’t work when it’s done. Thank you!
I recently stuck in the same problem too. I think your steps have some mistakes. You put the .mozconfig in the //browser_patches/firefox/checkout/ first, and then run //browser_patches/firefox/build.sh. I noticed that the script //browser_patches/firefox/build.sh would rewrite .mozconfig, causing that your firefox is not built with the original configure (The one with asan). To verify this, you can have a look at the .mozconfig after you run build.sh to build firefox. I modified the build.sh script:
and then run build.sh. After that I run my firefox with
//browser_patches/checkout/mach run
but error occurs: