Closed Bug 1271330 Opened 9 years ago Closed 8 years ago

Avoid homepage overrides in the default profile

Categories

(Remote Protocol :: Marionette, defect)

defect
Not set
normal

Tracking

(firefox49 fixed, firefox50 fixed, firefox51 fixed)

RESOLVED FIXED
mozilla51
Tracking Status
firefox49 --- fixed
firefox50 --- fixed
firefox51 --- fixed

People

(Reporter: davehunt, Assigned: CuriousLearner, Mentored)

Details

(Keywords: good-first-bug, Whiteboard: [lang=py])

Attachments

(1 file)

We should avoid homepage overrides in the default profile created by Marionette when launching Firefox. This can be achieved by setting the browser.startup.homepage_override.mstone preference to 'ignore' in testing/marionette/client/marionette_driver/geckoinstance.py See also: https://dxr.mozilla.org/mozilla-central/rev/e5a10bc7dac4ee2453d8319165c1f6578203eac7/browser/components/nsBrowserContentHandler.js#108-109
Mentor: dburns
Whiteboard: [good first bug][lang=py]
Hi Dave, I'd like to take this up. This will be my first attempt for mozilla-central. I have built the documentation to understand Marionette using Sphinx and I am currently reading it's documentation [1]. Regarding fix: From what I understand from your comment, adding browser.startup.homepage_override.mstone:'ignore' in the required_prefs dict of GeckoInstance in file: testing/marionette/client/marionette_driver/geckoinstance.py My Doubt: How do I test this ? Is testing on Marionette client as described in [1] enough or do I need to write further tests ? [1] https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette
After making the changes, I built again with "./mach build testing/". Post that I tested with Marionette in the following [1] manner. [1] https://pastebin.mozilla.org/8871392
(In reply to priyankt68 from comment #2) > After making the changes, I built again with "./mach build testing/". Post > that I tested with Marionette in the following [1] manner. > > [1] https://pastebin.mozilla.org/8871392 I think your pastebin has expired as I'm unable to see anything there. You can test your patch manually by instantiating Marionette and checking the preference has been set in the launched Firefox instance. Without this preference set you may also see a first-run page in Firefox, depending on the version you're launching.
I have created a new pastebin [1]. I did instantiate Marionette and then using "get_pref("browser.startup.homepage_override.mstone")" tried to get the value of the preference set. Take a look at this pastebin [1] I am getting the preference value as u'49.0a1', which is my buildId, I suppose. Before instantiating, I did make the changes, built again with "./mach build testing/" and then run the Firefox instance with "./mach run -marionette". Is this the right process ? Please let me know where am I going wrong OR depending upon by build, is this the expected result ? [1] https://pastebin.mozilla.org/8871602 (In reply to Dave Hunt (:davehunt) from comment #3) > (In reply to priyankt68 from comment #2) > > After making the changes, I built again with "./mach build testing/". Post > > that I tested with Marionette in the following [1] manner. > > > > [1] https://pastebin.mozilla.org/8871392 > > I think your pastebin has expired as I'm unable to see anything there. You > can test your patch manually by instantiating Marionette and checking the > preference has been set in the launched Firefox instance. Without this > preference set you may also see a first-run page in Firefox, depending on > the version you're launching.
Flags: needinfo?(dburns)
Rather than using pastebin, please use comments or attachments in Bugzilla. This avoids situations when the pastebin has expired or is otherwise not available. Your code: >>> from marionette import Marionette >>> client = Marionette(host='localhost', port=2828) >>> client.start_session() > {u'rotatable': False, u'raisesAccessibilityExceptions': False, u'takesScreenshot': True, u'acceptSslCerts': False, u'appBuildId': u'20160430163040', u'XULappId': u'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}', u'browserVersion': u'49.0a1', u'specificationLevel': 0, u'platform': u'DARWIN', u'browserName': u'Firefox', u'version': u'49.0a1', u'device': u'desktop', u'proxy': {}, u'platformVersion': u'15.4.0', u'takesElementScreenshot': True, u'platformName': u'Darwin', u'command_id': 1} >>> client.get_pref("browser.startup.homepage_override.mstone") > u'49.0a1' Your import suggests you're using the Marionette harness. You only need the Marionette driver (marionette-driver) package, and can import Marionette using: from marionette_driver.marionette import Marionette When you're instantiating Marionette, you're passing a host and port. I believe this will connect to an already running instance of Firefox, and therefore you will not be able to influence the profile (and preferences). Try instead passing a bin argument with the full path to the Firefox binary. This will then create a profile based on the defaults and launch a new Firefox instance using this profile. You should then be able to test using client.get_pref("browser.startup.homepage_override.mstone") and the value should be "ignore".
Flags: needinfo?(dburns)
I will not use pastebin in future. You are right. When I was instantiating Marionette, I was connecting to an already running instance of Firefox. I will try with bin argument and let you know the results with Marionetter driver. (In reply to Dave Hunt (:davehunt) from comment #5) > Rather than using pastebin, please use comments or attachments in Bugzilla. > This avoids situations when the pastebin has expired or is otherwise not > available. Your code: > > >>> from marionette import Marionette > >>> client = Marionette(host='localhost', port=2828) > >>> client.start_session() > > {u'rotatable': False, u'raisesAccessibilityExceptions': False, u'takesScreenshot': True, u'acceptSslCerts': False, u'appBuildId': u'20160430163040', u'XULappId': u'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}', u'browserVersion': u'49.0a1', u'specificationLevel': 0, u'platform': u'DARWIN', u'browserName': u'Firefox', u'version': u'49.0a1', u'device': u'desktop', u'proxy': {}, u'platformVersion': u'15.4.0', u'takesElementScreenshot': True, u'platformName': u'Darwin', u'command_id': 1} > >>> client.get_pref("browser.startup.homepage_override.mstone") > > u'49.0a1' > > Your import suggests you're using the Marionette harness. You only need the > Marionette driver (marionette-driver) package, and can import Marionette > using: from marionette_driver.marionette import Marionette > > When you're instantiating Marionette, you're passing a host and port. I > believe this will connect to an already running instance of Firefox, and > therefore you will not be able to influence the profile (and preferences). > Try instead passing a bin argument with the full path to the Firefox binary. > This will then create a profile based on the defaults and launch a new > Firefox instance using this profile. You should then be able to test using > client.get_pref("browser.startup.homepage_override.mstone") and the value > should be "ignore". (In reply to Dave Hunt (:davehunt) from comment #5) > Rather than using pastebin, please use comments or attachments in Bugzilla. > This avoids situations when the pastebin has expired or is otherwise not > available. Your code: > > >>> from marionette import Marionette > >>> client = Marionette(host='localhost', port=2828) > >>> client.start_session() > > {u'rotatable': False, u'raisesAccessibilityExceptions': False, u'takesScreenshot': True, u'acceptSslCerts': False, u'appBuildId': u'20160430163040', u'XULappId': u'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}', u'browserVersion': u'49.0a1', u'specificationLevel': 0, u'platform': u'DARWIN', u'browserName': u'Firefox', u'version': u'49.0a1', u'device': u'desktop', u'proxy': {}, u'platformVersion': u'15.4.0', u'takesElementScreenshot': True, u'platformName': u'Darwin', u'command_id': 1} > >>> client.get_pref("browser.startup.homepage_override.mstone") > > u'49.0a1' > > Your import suggests you're using the Marionette harness. You only need the > Marionette driver (marionette-driver) package, and can import Marionette > using: from marionette_driver.marionette import Marionette > > When you're instantiating Marionette, you're passing a host and port. I > believe this will connect to an already running instance of Firefox, and > therefore you will not be able to influence the profile (and preferences). > Try instead passing a bin argument with the full path to the Firefox binary. > This will then create a profile based on the defaults and launch a new > Firefox instance using this profile. You should then be able to test using > client.get_pref("browser.startup.homepage_override.mstone") and the value > should be "ignore". (In reply to Dave Hunt (:davehunt) from comment #5) > Rather than using pastebin, please use comments or attachments in Bugzilla. > This avoids situations when the pastebin has expired or is otherwise not > available. Your code: > > >>> from marionette import Marionette > >>> client = Marionette(host='localhost', port=2828) > >>> client.start_session() > > {u'rotatable': False, u'raisesAccessibilityExceptions': False, u'takesScreenshot': True, u'acceptSslCerts': False, u'appBuildId': u'20160430163040', u'XULappId': u'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}', u'browserVersion': u'49.0a1', u'specificationLevel': 0, u'platform': u'DARWIN', u'browserName': u'Firefox', u'version': u'49.0a1', u'device': u'desktop', u'proxy': {}, u'platformVersion': u'15.4.0', u'takesElementScreenshot': True, u'platformName': u'Darwin', u'command_id': 1} > >>> client.get_pref("browser.startup.homepage_override.mstone") > > u'49.0a1' > > Your import suggests you're using the Marionette harness. You only need the > Marionette driver (marionette-driver) package, and can import Marionette > using: from marionette_driver.marionette import Marionette > > When you're instantiating Marionette, you're passing a host and port. I > believe this will connect to an already running instance of Firefox, and > therefore you will not be able to influence the profile (and preferences). > Try instead passing a bin argument with the full path to the Firefox binary. > This will then create a profile based on the defaults and launch a new > Firefox instance using this profile. You should then be able to test using > client.get_pref("browser.startup.homepage_override.mstone") and the value > should be "ignore". (In reply to Dave Hunt (:davehunt) from comment #5) > Rather than using pastebin, please use comments or attachments in Bugzilla. > This avoids situations when the pastebin has expired or is otherwise not > available. Your code: > > >>> from marionette import Marionette > >>> client = Marionette(host='localhost', port=2828) > >>> client.start_session() > > {u'rotatable': False, u'raisesAccessibilityExceptions': False, u'takesScreenshot': True, u'acceptSslCerts': False, u'appBuildId': u'20160430163040', u'XULappId': u'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}', u'browserVersion': u'49.0a1', u'specificationLevel': 0, u'platform': u'DARWIN', u'browserName': u'Firefox', u'version': u'49.0a1', u'device': u'desktop', u'proxy': {}, u'platformVersion': u'15.4.0', u'takesElementScreenshot': True, u'platformName': u'Darwin', u'command_id': 1} > >>> client.get_pref("browser.startup.homepage_override.mstone") > > u'49.0a1' > > Your import suggests you're using the Marionette harness. You only need the > Marionette driver (marionette-driver) package, and can import Marionette > using: from marionette_driver.marionette import Marionette > > When you're instantiating Marionette, you're passing a host and port. I > believe this will connect to an already running instance of Firefox, and > therefore you will not be able to influence the profile (and preferences). > Try instead passing a bin argument with the full path to the Firefox binary. > This will then create a profile based on the defaults and launch a new > Firefox instance using this profile. You should then be able to test using > client.get_pref("browser.startup.homepage_override.mstone") and the value > should be "ignore".
Hi Dave, I did test using Marionette driver package and I still do not get the desired results. Here is what I did. ``` >>> from marionette_driver.marionette import Marionette >>> client = Marionette(host='localhost', port=2922, bin='/Users/priyanktrivedi/mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/firefox-bin') >>> client.start_session() > {u'rotatable': False, u'raisesAccessibilityExceptions': False, u'takesScreenshot': True, u'acceptSslCerts': False, u'appBuildId': u'20160430163040', u'XULappId': u'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}', u'browserVersion': u'49.0a1', u'specificationLevel': 0, u'platform': u'DARWIN', u'browserName': u'Firefox', u'version': u'49.0a1', u'device': u'desktop', u'proxy': {}, u'platformVersion': u'15.4.0', u'takesElementScreenshot': True, u'platformName': u'Darwin', u'command_id': 1} >>> client.get_pref("browser.startup.homepage_override.mstone") > u'49.0a1' ``` Please suggest where am I going wrong. (In reply to Dave Hunt (:davehunt) from comment #5) > Rather than using pastebin, please use comments or attachments in Bugzilla. > This avoids situations when the pastebin has expired or is otherwise not > available. Your code: > > >>> from marionette import Marionette > >>> client = Marionette(host='localhost', port=2828) > >>> client.start_session() > > {u'rotatable': False, u'raisesAccessibilityExceptions': False, u'takesScreenshot': True, u'acceptSslCerts': False, u'appBuildId': u'20160430163040', u'XULappId': u'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}', u'browserVersion': u'49.0a1', u'specificationLevel': 0, u'platform': u'DARWIN', u'browserName': u'Firefox', u'version': u'49.0a1', u'device': u'desktop', u'proxy': {}, u'platformVersion': u'15.4.0', u'takesElementScreenshot': True, u'platformName': u'Darwin', u'command_id': 1} > >>> client.get_pref("browser.startup.homepage_override.mstone") > > u'49.0a1' > > Your import suggests you're using the Marionette harness. You only need the > Marionette driver (marionette-driver) package, and can import Marionette > using: from marionette_driver.marionette import Marionette > > When you're instantiating Marionette, you're passing a host and port. I > believe this will connect to an already running instance of Firefox, and > therefore you will not be able to influence the profile (and preferences). > Try instead passing a bin argument with the full path to the Firefox binary. > This will then create a profile based on the defaults and launch a new > Firefox instance using this profile. You should then be able to test using > client.get_pref("browser.startup.homepage_override.mstone") and the value > should be "ignore".
(In reply to Priyank Trivedi from comment #7) > Hi Dave, > > I did test using Marionette driver package and I still do not get the > desired results. Here is what I did. > > ``` > >>> from marionette_driver.marionette import Marionette > >>> client = Marionette(host='localhost', port=2922, bin='/Users/priyanktrivedi/mozilla/mozilla-central/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS/firefox-bin') > >>> client.start_session() > > {u'rotatable': False, u'raisesAccessibilityExceptions': False, u'takesScreenshot': True, u'acceptSslCerts': False, u'appBuildId': u'20160430163040', u'XULappId': u'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}', u'browserVersion': u'49.0a1', u'specificationLevel': 0, u'platform': u'DARWIN', u'browserName': u'Firefox', u'version': u'49.0a1', u'device': u'desktop', u'proxy': {}, u'platformVersion': u'15.4.0', u'takesElementScreenshot': True, u'platformName': u'Darwin', u'command_id': 1} > >>> client.get_pref("browser.startup.homepage_override.mstone") > > u'49.0a1' You shouldn't need to specify the host or port, as the defaults should be acceptable. That said, I'd need to see your code changes to understand why you're not seeing the new preference value. Where are you setting this? It's also important that you're using the code from your local source, and not running with packages installed from PyPI. To do this, first make sure you're running in a clean virtual environment (or at least uninstall the existing marionette-driver package), and then run: > $ cd testing/marionette/client > $ python setup.py develop Any changes you then make to the client will be reflected in the installed package.
Are you still interested in working on this Priyank?
Assignee: nobody → priyankt68
Flags: needinfo?(priyankt68)
Looks like Priyank is no longer around. Sanyam, you were seeking for a new bug. Maybe you would be interested in? It's a somewhat useful one we would like to have.
Assignee: priyankt68 → nobody
Flags: needinfo?(sanyam.khurana01)
Keywords: good-first-bug
Whiteboard: [good first bug][lang=py] → [lang=py]
Hi @whimboo! Sure, I would love to work on this bug. I've tried the above steps and I'm able to do this: In [1]: from marionette_driver.marionette import Marionette In [2]: client = Marionette() In [3]: client.start_session() Out[3]: {u'XULappId': u'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}', u'acceptSslCerts': False, u'appBuildId': u'20160822103436', u'browserName': u'firefox', u'browserVersion': u'51.0a1', u'command_id': 1, u'platform': u'DARWIN', u'platformName': u'darwin', u'platformVersion': u'15.6.0', u'processId': 73311, u'proxy': {}, u'raisesAccessibilityExceptions': False, u'rotatable': False, u'specificationLevel': 0, u'takesElementScreenshot': True, u'takesScreenshot': True, u'version': u'51.0a1'} In [4]: client.get_pref("browser.startup.homepage_override.mstone") Out[4]: u'ignore' What's next?
Flags: needinfo?(sanyam.khurana01)
Dave, what was the exact example when you have seen this problem? Looks like using Marionette directly with a fresh profile works the same whether the pref has been set or not.
Flags: needinfo?(priyankt68) → needinfo?(dave.hunt)
Can you try on a release version of Firefox? I suspect the default value for this preference is different on Nightly. In [1]: from marionette_driver.marionette import Marionette In [2]: client = Marionette(bin='/Applications/Firefox 48.app/Contents/MacOS/firefox-bin') In [3]: client.start_session() Out[3]: {u'XULappId': u'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}', u'acceptSslCerts': False, u'appBuildId': u'20160726073904', u'browserName': u'Firefox', u'browserVersion': u'48.0', u'command_id': 1, u'device': u'desktop', u'platform': u'DARWIN', u'platformName': u'Darwin', u'platformVersion': u'15.6.0', u'proxy': {}, u'raisesAccessibilityExceptions': False, u'rotatable': False, u'specificationLevel': 0, u'takesElementScreenshot': True, u'takesScreenshot': True, u'version': u'48.0'} In [4]: client.get_pref("browser.startup.homepage_override.mstone") Out[4]: u'48.0'
Flags: needinfo?(dave.hunt) → needinfo?(sanyam.khurana01)
Hi Dave! It shows me this: In [1]: from marionette_driver.marionette import Marionette In [2]: client = Marionette(bin='/Applications/Firefox.app/Contents/MacOS/firefox-bin') In [3]: client.start_session() Out[3]: {u'XULappId': u'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}', u'acceptSslCerts': False, u'appBuildId': u'20160623154057', u'browserName': u'Firefox', u'browserVersion': u'47.0.1', u'command_id': 1, u'device': u'desktop', u'platform': u'DARWIN', u'platformName': u'Darwin', u'platformVersion': u'15.6.0', u'proxy': {}, u'raisesAccessibilityExceptions': False, u'rotatable': False, u'specificationLevel': 0, u'takesElementScreenshot': True, u'takesScreenshot': True, u'version': u'47.0.1'} In [4]: client.get_pref("browser.startup.homepage_override.mstone") Out[4]: u'ignore' I've changed the path for the bin here, since I don't have that version of Firefox.
Flags: needinfo?(sanyam.khurana01) → needinfo?(dburns)
Also, the above is when I've preference set up on my nightly build, if I remove that and execute the same as above (running release version) I get this: In [1]: from marionette_driver.marionette import Marionette In [2]: client = Marionette(bin='/Applications/Firefox.app/Contents/MacOS/firefox-bin') In [3]: client.start_session() Out[3]: {u'XULappId': u'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}', u'acceptSslCerts': False, u'appBuildId': u'20160623154057', u'browserName': u'Firefox', u'browserVersion': u'47.0.1', u'command_id': 1, u'device': u'desktop', u'platform': u'DARWIN', u'platformName': u'Darwin', u'platformVersion': u'15.6.0', u'proxy': {}, u'raisesAccessibilityExceptions': False, u'rotatable': False, u'specificationLevel': 0, u'takesElementScreenshot': True, u'takesScreenshot': True, u'version': u'47.0.1'} In [4]: client.get_pref("browser.startup.homepage_override.mstone") Out[4]: u'47.0.1'
Looks good. Can you push your change to Mozreview (details to get it setup at http://mozilla-version-control-tools.readthedocs.io/en/latest/mozreview.html) so we can review.
Flags: needinfo?(dburns)
Comment on attachment 8784725 [details] Bug 1271330 - Avoid homepage overrides in the default profile; https://reviewboard.mozilla.org/r/74058/#review71956 Change looks good and when tested locally Firefox 48 no longer launches with a first run page.
Attachment #8784725 - Flags: review?(dave.hunt) → review+
Comment on attachment 8784725 [details] Bug 1271330 - Avoid homepage overrides in the default profile; https://reviewboard.mozilla.org/r/74058/#review71988 ::: testing/marionette/client/marionette_driver/geckoinstance.py:46 (Diff revision 1) > "startup.homepage_welcome_url.additional": "", > "toolkit.telemetry.enabled": False, > # Until Bug 1238095 is fixed, we have to enable CPOWs in order > # for Marionette tests to work properly. > "dom.ipc.cpows.forbid-unsafe-from-browser": False, > + "browser.startup.homepage_override.mstone": "ignore" Please add this entry next to the other browser related preferences, so it's also sorted alphabetically. Also please add a comment before which states that this only happens for branded builds of Firefox. With both fixed r=me.
Comment on attachment 8784725 [details] Bug 1271330 - Avoid homepage overrides in the default profile; https://reviewboard.mozilla.org/r/74058/#review71990
Attachment #8784725 - Flags: review?(hskupin) → review+
I think this patch has a kinda low risk to break something, so it would be great to have it also for aurora and beta.
Assignee: nobody → sanyam.khurana01
Mentor: dburns → hskupin
Status: NEW → ASSIGNED
Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1c39b57bd204 Avoid homepage overrides in the default profile; r=davehunt,whimboo
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Please land this test-only patch to aurora and beta. Thanks.
Whiteboard: [lang=py] → [lang=py][checkin-needed-aurora][checkin-needed-beta]
Whiteboard: [lang=py][checkin-needed-aurora][checkin-needed-beta] → [lang=py]
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: