From a5338276833b5d5ee629c9b8a53c86832e4e9333 Mon Sep 17 00:00:00 2001 From: Matthew Gregan Date: Wed, 18 Feb 2015 11:02:00 +1300 Subject: [PATCH 001/115] Bug 1133645 - Check size of audio_specific_config before use. r=snorp --- dom/media/fmp4/android/AndroidDecoderModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/media/fmp4/android/AndroidDecoderModule.cpp b/dom/media/fmp4/android/AndroidDecoderModule.cpp index 895b4e672d71..273fafc829fa 100644 --- a/dom/media/fmp4/android/AndroidDecoderModule.cpp +++ b/dom/media/fmp4/android/AndroidDecoderModule.cpp @@ -205,7 +205,7 @@ public: jni::Object::LocalRef buffer(env); NS_ENSURE_SUCCESS_VOID(aFormat->GetByteBuffer(NS_LITERAL_STRING("csd-0"), &buffer)); - if (!buffer) { + if (!buffer && aConfig.audio_specific_config->Length() >= 2) { csd0[0] = (*aConfig.audio_specific_config)[0]; csd0[1] = (*aConfig.audio_specific_config)[1]; From 8b8ae2538dc85e826607bb3a8abe1b1f1daaa017 Mon Sep 17 00:00:00 2001 From: Matthew Gregan Date: Tue, 17 Feb 2015 11:52:59 +1300 Subject: [PATCH 002/115] Bug 1132257 - Update cubeb from upstream. r=padenot --- media/libcubeb/README_MOZILLA | 2 +- media/libcubeb/src/cubeb_audiounit.c | 2 - media/libcubeb/src/cubeb_wasapi.cpp | 258 +++++++++++++++------------ media/libcubeb/src/cubeb_winmm.c | 4 + 4 files changed, 150 insertions(+), 116 deletions(-) diff --git a/media/libcubeb/README_MOZILLA b/media/libcubeb/README_MOZILLA index c682ea4f7f2e..141b1a0727c5 100644 --- a/media/libcubeb/README_MOZILLA +++ b/media/libcubeb/README_MOZILLA @@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system. The cubeb git repository is: git://github.com/kinetiknz/cubeb.git -The git commit ID used was 14d97931da6435d10aa4dcb444896af0314372f4. +The git commit ID used was 66aa55bb3b883381a73ad12d20688b932858be28. diff --git a/media/libcubeb/src/cubeb_audiounit.c b/media/libcubeb/src/cubeb_audiounit.c index 28201d19c8c3..fbe7f9244c0a 100644 --- a/media/libcubeb/src/cubeb_audiounit.c +++ b/media/libcubeb/src/cubeb_audiounit.c @@ -477,7 +477,6 @@ audiounit_stream_init(cubeb * context, cubeb_stream ** stream, char const * stre unsigned int buffer_size, default_buffer_size; OSStatus r; UInt32 size; - AudioDeviceID output_device_id; AudioValueRange latency_range; assert(context); @@ -783,7 +782,6 @@ audiounit_stream_get_latency(cubeb_stream * stm, uint32_t * latency) int audiounit_stream_set_volume(cubeb_stream * stm, float volume) { - AudioDeviceID id; OSStatus r; r = AudioUnitSetParameter(stm->unit, diff --git a/media/libcubeb/src/cubeb_wasapi.cpp b/media/libcubeb/src/cubeb_wasapi.cpp index d769ab1570ed..d40f78019f23 100644 --- a/media/libcubeb/src/cubeb_wasapi.cpp +++ b/media/libcubeb/src/cubeb_wasapi.cpp @@ -34,15 +34,14 @@ // #define LOGGING_ENABLED #ifdef LOGGING_ENABLED -# define LOG(...) do { \ - fprintf(stdout, __VA_ARGS__); \ - fprintf(stdout, "\n"); \ -} while(0); +#define LOG(...) do { \ + fprintf(stderr, __VA_ARGS__); \ + } while(0) #else -# define LOG(...) +#define LOG(...) #endif -#define ARRAY_LENGTH(array_) \ +#define ARRAY_LENGTH(array_) \ (sizeof(array_) / sizeof(array_[0])) namespace { @@ -85,7 +84,6 @@ void SafeRelease(T * ptr) class owned_critical_section { public: - owned_critical_section() #ifdef DEBUG : owner(0) @@ -136,7 +134,7 @@ private: struct auto_lock { auto_lock(owned_critical_section * lock) - :lock(lock) + : lock(lock) { lock->enter(); } @@ -150,7 +148,7 @@ private: struct auto_unlock { auto_unlock(owned_critical_section * lock) - :lock(lock) + : lock(lock) { lock->leave(); } @@ -163,33 +161,29 @@ private: }; struct auto_com { - auto_com() - : need_uninit(false) { - HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); - // This is for information purposes only, in anycase, COM is initialized - // at the end of the constructor. - if (hr == RPC_E_CHANGED_MODE) { - // This is an error, COM was not initialized by this function, so it is + auto_com() { + result = CoInitializeEx(NULL, COINIT_MULTITHREADED); + } + ~auto_com() { + if (result == RPC_E_CHANGED_MODE) { + // This is not an error, COM was not initialized by this function, so it is // not necessary to uninit it. - LOG("COM already initialized in STA."); - } else if (hr == S_FALSE) { + LOG("COM already initialized in STA.\n"); + } else if (result == S_FALSE) { // This is not an error. We are allowed to call CoInitializeEx more than // once, as long as it is matches by an CoUninitialize call. // We do that in the dtor which is guaranteed to be called. - LOG("COM already initialized in MTA"); - need_uninit = true; - } else if (hr == S_OK) { - LOG("COM initialized."); - need_uninit = true; + LOG("COM already initialized in MTA\n"); } - } - ~auto_com() { - if (need_uninit) { + if (SUCCEEDED(result)) { CoUninitialize(); } } + bool ok() { + return result == RPC_E_CHANGED_MODE || SUCCEEDED(result); + } private: - bool need_uninit; + HRESULT result; }; typedef HANDLE (WINAPI *set_mm_thread_characteristics_function)( @@ -205,7 +199,6 @@ int setup_wasapi_stream(cubeb_stream * stm); } - struct cubeb { cubeb_ops const * ops; @@ -258,7 +251,7 @@ struct cubeb_stream HANDLE refill_event; /* Each cubeb_stream has its own thread. */ HANDLE thread; - /* We synthetize our clock from the callbacks. */ + /* We synthesize our clock from the callbacks. */ LONG64 clock; owned_critical_section * stream_reset_lock; /* Maximum number of frames we can be requested in a callback. */ @@ -296,7 +289,7 @@ public: HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, VOID **ppvInterface) { - if (IID_IUnknown == riid) { + if (__uuidof(IUnknown) == riid) { AddRef(); *ppvInterface = (IUnknown*)this; } else if (__uuidof(IMMNotificationClient) == riid) { @@ -326,7 +319,10 @@ public: return S_OK; } - auto_com autocom; + auto_com com; + if (!com.ok()) { + return E_FAIL; + } /* Close the stream */ wasapi_stream_stop(stm); @@ -346,27 +342,27 @@ public: * log is enabled), for debugging. */ HRESULT STDMETHODCALLTYPE OnDeviceAdded(LPCWSTR device_id) { - LOG("Audio device added."); + LOG("Audio device added.\n"); return S_OK; }; HRESULT STDMETHODCALLTYPE OnDeviceRemoved(LPCWSTR device_id) { - LOG("Audio device removed."); + LOG("Audio device removed.\n"); return S_OK; } HRESULT STDMETHODCALLTYPE OnDeviceStateChanged(LPCWSTR device_id, DWORD new_state) { - LOG("Audio device state changed."); + LOG("Audio device state changed.\n"); return S_OK; } HRESULT STDMETHODCALLTYPE OnPropertyValueChanged(LPCWSTR device_id, const PROPERTYKEY key) { - LOG("Audio device property value changed."); + LOG("Audio device property value changed.\n"); return S_OK; } private: @@ -488,7 +484,7 @@ refill(cubeb_stream * stm, float * data, long frames_needed) /* Go in draining mode if we got fewer frames than requested. */ if (out_frames < frames_needed) { - LOG("draining."); + LOG("draining.\n"); stm->draining = true; } @@ -513,10 +509,14 @@ wasapi_stream_render_loop(LPVOID stream) bool is_playing = true; HANDLE wait_array[2] = {stm->shutdown_event, stm->refill_event}; HANDLE mmcss_handle = NULL; - HRESULT hr; + HRESULT hr = 0; bool first = true; DWORD mmcss_task_index = 0; auto_com com; + if (!com.ok()) { + LOG("COM initialization failed on render_loop thread.\n"); + return 0; + } /* We could consider using "Pro Audio" here for WebAudio and * maybe WebRTC. */ @@ -524,7 +524,7 @@ wasapi_stream_render_loop(LPVOID stream) stm->context->set_mm_thread_characteristics("Audio", &mmcss_task_index); if (!mmcss_handle) { /* This is not fatal, but we might glitch under heavy load. */ - LOG("Unable to use mmcss to bump the render thread priority: %x", GetLastError()); + LOG("Unable to use mmcss to bump the render thread priority: %x\n", GetLastError()); } @@ -549,7 +549,7 @@ wasapi_stream_render_loop(LPVOID stream) hr = stm->client->GetCurrentPadding(&padding); if (FAILED(hr)) { - LOG("Failed to get padding"); + LOG("Failed to get padding\n"); is_playing = false; continue; } @@ -576,11 +576,11 @@ wasapi_stream_render_loop(LPVOID stream) hr = stm->render_client->ReleaseBuffer(available, 0); if (FAILED(hr)) { - LOG("failed to release buffer."); + LOG("failed to release buffer.\n"); is_playing = false; } } else { - LOG("failed to get buffer."); + LOG("failed to get buffer.\n"); is_playing = false; } } @@ -619,7 +619,7 @@ HRESULT register_notification_client(cubeb_stream * stm) IID_PPV_ARGS(&stm->device_enumerator)); if (FAILED(hr)) { - LOG("Could not get device enumerator: %x", hr); + LOG("Could not get device enumerator: %x\n", hr); return hr; } @@ -628,7 +628,7 @@ HRESULT register_notification_client(cubeb_stream * stm) hr = stm->device_enumerator->RegisterEndpointNotificationCallback(stm->notification_client); if (FAILED(hr)) { - LOG("Could not register endpoint notification callback: %x", hr); + LOG("Could not register endpoint notification callback: %x\n", hr); return hr; } @@ -657,9 +657,8 @@ HRESULT get_default_endpoint(IMMDevice ** device) HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&enumerator)); - if (FAILED(hr)) { - LOG("Could not get device enumerator."); + LOG("Could not get device enumerator.\n"); return hr; } /* eMultimedia is okay for now ("Music, movies, narration, [...]"). @@ -668,7 +667,7 @@ HRESULT get_default_endpoint(IMMDevice ** device) * and eCommunication ("Voice communication"). */ hr = enumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, device); if (FAILED(hr)) { - LOG("Could not get default audio endpoint. %d", __LINE__); + LOG("Could not get default audio endpoint. %d\n", __LINE__); SafeRelease(enumerator); return hr; } @@ -684,6 +683,9 @@ int wasapi_init(cubeb ** context, char const * context_name) { HRESULT hr; auto_com com; + if (!com.ok()) { + return CUBEB_ERROR; + } /* We don't use the device yet, but need to make sure we can initialize one so that this backend is not incorrectly enabled on platforms that don't @@ -691,7 +693,7 @@ int wasapi_init(cubeb ** context, char const * context_name) IMMDevice * device; hr = get_default_endpoint(&device); if (FAILED(hr)) { - LOG("Could not get device."); + LOG("Could not get device.\n"); return CUBEB_ERROR; } SafeRelease(device); @@ -710,13 +712,13 @@ int wasapi_init(cubeb ** context, char const * context_name) (revert_mm_thread_characteristics_function) GetProcAddress( ctx->mmcss_module, "AvRevertMmThreadCharacteristics"); if (!(ctx->set_mm_thread_characteristics && ctx->revert_mm_thread_characteristics)) { - LOG("Could not load AvSetMmThreadCharacteristics or AvRevertMmThreadCharacteristics: %x", GetLastError()); + LOG("Could not load AvSetMmThreadCharacteristics or AvRevertMmThreadCharacteristics: %x\n", GetLastError()); FreeLibrary(ctx->mmcss_module); } } else { // This is not a fatal error, but we might end up glitching when // the system is under high load. - LOG("Could not load Avrt.dll"); + LOG("Could not load Avrt.dll\n"); ctx->set_mm_thread_characteristics = &set_mm_thread_characteristics_noop; ctx->revert_mm_thread_characteristics = &revert_mm_thread_characteristics_noop; } @@ -749,6 +751,9 @@ wasapi_get_max_channel_count(cubeb * ctx, uint32_t * max_channels) IAudioClient * client; WAVEFORMATEX * mix_format; auto_com com; + if (!com.ok()) { + return CUBEB_ERROR; + } assert(ctx && max_channels); @@ -787,11 +792,14 @@ wasapi_get_min_latency(cubeb * ctx, cubeb_stream_params params, uint32_t * laten IAudioClient * client; REFERENCE_TIME default_period; auto_com com; + if (!com.ok()) { + return CUBEB_ERROR; + } IMMDevice * device; hr = get_default_endpoint(&device); if (FAILED(hr)) { - LOG("Could not get default endpoint:%x.", hr) + LOG("Could not get default endpoint:%x.\n", hr); return CUBEB_ERROR; } @@ -800,7 +808,7 @@ wasapi_get_min_latency(cubeb * ctx, cubeb_stream_params params, uint32_t * laten NULL, (void **)&client); SafeRelease(device); if (FAILED(hr)) { - LOG("Could not activate device for latency: %x.", hr) + LOG("Could not activate device for latency: %x.\n", hr); return CUBEB_ERROR; } @@ -808,11 +816,11 @@ wasapi_get_min_latency(cubeb * ctx, cubeb_stream_params params, uint32_t * laten hr = client->GetDevicePeriod(&default_period, NULL); if (FAILED(hr)) { SafeRelease(client); - LOG("Could not get device period: %x.", hr) + LOG("Could not get device period: %x.\n", hr); return CUBEB_ERROR; } - LOG("default device period: %ld", default_period) + LOG("default device period: %ld\n", default_period); /* According to the docs, the best latency we can achieve is by synchronizing * the stream and the engine. @@ -831,6 +839,9 @@ wasapi_get_preferred_sample_rate(cubeb * ctx, uint32_t * rate) IAudioClient * client; WAVEFORMATEX * mix_format; auto_com com; + if (!com.ok()) { + return CUBEB_ERROR; + } IMMDevice * device; hr = get_default_endpoint(&device); @@ -915,7 +926,7 @@ handle_channel_layout(cubeb_stream * stm, WAVEFORMATEX ** mix_format, const cub if (hr == S_FALSE) { /* Not supported, but WASAPI gives us a suggestion. Use it, and handle the * eventual upmix/downmix ourselves */ - LOG("Using WASAPI suggested format: channels: %d", closest->nChannels); + LOG("Using WASAPI suggested format: channels: %d\n", closest->nChannels); WAVEFORMATEXTENSIBLE * closest_pcm = reinterpret_cast(closest); assert(closest_pcm->SubFormat == format_pcm->SubFormat); CoTaskMemFree(*mix_format); @@ -926,7 +937,7 @@ handle_channel_layout(cubeb_stream * stm, WAVEFORMATEX ** mix_format, const cub * of the code figure out the right conversion path. */ **mix_format = hw_mixformat; } else if (hr == S_OK) { - LOG("Requested format accepted by WASAPI."); + LOG("Requested format accepted by WASAPI.\n"); } } @@ -936,15 +947,20 @@ int setup_wasapi_stream(cubeb_stream * stm) IMMDevice * device; WAVEFORMATEX * mix_format; +#ifdef DEBUG stm->stream_reset_lock->assert_current_thread_owns(); +#endif auto_com com; + if (!com.ok()) { + return CUBEB_ERROR; + } assert(!stm->client && "WASAPI stream already setup, close it first."); hr = get_default_endpoint(&device); if (FAILED(hr)) { - LOG("Could not get default endpoint, error: %x", hr); + LOG("Could not get default endpoint, error: %x\n", hr); auto_unlock unlock(stm->stream_reset_lock); wasapi_stream_destroy(stm); return CUBEB_ERROR; @@ -953,11 +969,11 @@ int setup_wasapi_stream(cubeb_stream * stm) /* Get a client. We will get all other interfaces we need from * this pointer. */ hr = device->Activate(__uuidof(IAudioClient), - CLSCTX_INPROC_SERVER, - NULL, (void **)&stm->client); + CLSCTX_INPROC_SERVER, + NULL, (void **)&stm->client); SafeRelease(device); if (FAILED(hr)) { - LOG("Could not activate the device to get an audio client: error: %x", hr); + LOG("Could not activate the device to get an audio client: error: %x\n", hr); auto_unlock unlock(stm->stream_reset_lock); wasapi_stream_destroy(stm); return CUBEB_ERROR; @@ -967,7 +983,7 @@ int setup_wasapi_stream(cubeb_stream * stm) * and the format the stream we want to play uses. */ hr = stm->client->GetMixFormat(&mix_format); if (FAILED(hr)) { - LOG("Could not fetch current mix format from the audio client: error: %x", hr); + LOG("Could not fetch current mix format from the audio client: error: %x\n", hr); auto_unlock unlock(stm->stream_reset_lock); wasapi_stream_destroy(stm); return CUBEB_ERROR; @@ -982,17 +998,17 @@ int setup_wasapi_stream(cubeb_stream * stm) stm->mix_params.channels = mix_format->nChannels; hr = stm->client->Initialize(AUDCLNT_SHAREMODE_SHARED, - AUDCLNT_STREAMFLAGS_EVENTCALLBACK | - AUDCLNT_STREAMFLAGS_NOPERSIST, - ms_to_hns(stm->latency), - 0, - mix_format, - NULL); + AUDCLNT_STREAMFLAGS_EVENTCALLBACK | + AUDCLNT_STREAMFLAGS_NOPERSIST, + ms_to_hns(stm->latency), + 0, + mix_format, + NULL); CoTaskMemFree(mix_format); if (FAILED(hr)) { - LOG("Unable to initialize audio client: %x.", hr); + LOG("Unable to initialize audio client: %x.\n", hr); auto_unlock unlock(stm->stream_reset_lock); wasapi_stream_destroy(stm); return CUBEB_ERROR; @@ -1000,37 +1016,37 @@ int setup_wasapi_stream(cubeb_stream * stm) hr = stm->client->GetBufferSize(&stm->buffer_frame_count); if (FAILED(hr)) { - LOG("Could not get the buffer size from the client %x.", hr); + LOG("Could not get the buffer size from the client %x.\n", hr); auto_unlock unlock(stm->stream_reset_lock); wasapi_stream_destroy(stm); return CUBEB_ERROR; } if (should_upmix(stm) || should_downmix(stm)) { - stm->mix_buffer = (float *)malloc(frames_to_bytes_before_mix(stm, stm->buffer_frame_count)); + stm->mix_buffer = (float *) malloc(frames_to_bytes_before_mix(stm, stm->buffer_frame_count)); } hr = stm->client->SetEventHandle(stm->refill_event); if (FAILED(hr)) { - LOG("Could set the event handle for the client %x.", hr); + LOG("Could set the event handle for the client %x.\n", hr); auto_unlock unlock(stm->stream_reset_lock); wasapi_stream_destroy(stm); return CUBEB_ERROR; } hr = stm->client->GetService(__uuidof(IAudioRenderClient), - (void **)&stm->render_client); + (void **)&stm->render_client); if (FAILED(hr)) { - LOG("Could not get the render client %x.", hr); + LOG("Could not get the render client %x.\n", hr); auto_unlock unlock(stm->stream_reset_lock); wasapi_stream_destroy(stm); return CUBEB_ERROR; } hr = stm->client->GetService(__uuidof(IAudioStreamVolume), - (void **)&stm->audio_stream_volume); + (void **)&stm->audio_stream_volume); if (FAILED(hr)) { - LOG("Could not get the IAudioStreamVolume %x.", hr); + LOG("Could not get the IAudioStreamVolume %x.\n", hr); auto_unlock unlock(stm->stream_reset_lock); wasapi_stream_destroy(stm); return CUBEB_ERROR; @@ -1041,14 +1057,14 @@ int setup_wasapi_stream(cubeb_stream * stm) * of channels of the stream, not the number of channels * that WASAPI wants. */ stm->resampler = cubeb_resampler_create(stm, stm->stream_params, - stm->mix_params.rate, - stm->data_callback, - stm->buffer_frame_count, - stm->user_ptr, - CUBEB_RESAMPLER_QUALITY_DESKTOP); + stm->mix_params.rate, + stm->data_callback, + stm->buffer_frame_count, + stm->user_ptr, + CUBEB_RESAMPLER_QUALITY_DESKTOP); if (!stm->resampler) { + LOG("Could not get a resampler\n"); auto_unlock unlock(stm->stream_reset_lock); - LOG("Could not get a resampler"); wasapi_stream_destroy(stm); return CUBEB_ERROR; } @@ -1065,6 +1081,9 @@ wasapi_stream_init(cubeb * context, cubeb_stream ** stream, HRESULT hr; int rv; auto_com com; + if (!com.ok()) { + return CUBEB_ERROR; + } assert(context && stream); @@ -1082,12 +1101,12 @@ wasapi_stream_init(cubeb * context, cubeb_stream ** stream, stm->clock = 0; /* Null out WASAPI-specific state */ - stm->resampler = nullptr; - stm->client = nullptr; - stm->render_client = nullptr; - stm->audio_stream_volume = nullptr; - stm->device_enumerator = nullptr; - stm->notification_client = nullptr; + stm->resampler = NULL; + stm->client = NULL; + stm->render_client = NULL; + stm->audio_stream_volume = NULL; + stm->device_enumerator = NULL; + stm->notification_client = NULL; stm->stream_reset_lock = new owned_critical_section(); @@ -1095,14 +1114,14 @@ wasapi_stream_init(cubeb * context, cubeb_stream ** stream, stm->refill_event = CreateEvent(NULL, 0, 0, NULL); if (!stm->shutdown_event) { - LOG("Can't create the shutdown event, error: %x.", GetLastError()); + LOG("Can't create the shutdown event, error: %x\n", GetLastError()); wasapi_stream_destroy(stm); return CUBEB_ERROR; } if (!stm->refill_event) { SafeRelease(stm->shutdown_event); - LOG("Can't create the refill event, error: %x.", GetLastError()); + LOG("Can't create the refill event, error: %x\n", GetLastError()); wasapi_stream_destroy(stm); return CUBEB_ERROR; } @@ -1122,7 +1141,7 @@ wasapi_stream_init(cubeb * context, cubeb_stream ** stream, if (FAILED(hr)) { /* this is not fatal, we can still play audio, but we won't be able * to keep using the default audio endpoint if it changes. */ - LOG("failed to register notification client, %x", hr); + LOG("failed to register notification client, %x\n", hr); } *stream = stm; @@ -1134,21 +1153,23 @@ void close_wasapi_stream(cubeb_stream * stm) { assert(stm); +#ifdef DEBUG stm->stream_reset_lock->assert_current_thread_owns(); +#endif SafeRelease(stm->client); - stm->client = nullptr; + stm->client = NULL; SafeRelease(stm->render_client); - stm->client = nullptr; + stm->render_client = NULL; if (stm->resampler) { cubeb_resampler_destroy(stm->resampler); - stm->resampler = nullptr; + stm->resampler = NULL; } free(stm->mix_buffer); - stm->mix_buffer = nullptr; + stm->mix_buffer = NULL; } void wasapi_stream_destroy(cubeb_stream * stm) @@ -1158,8 +1179,14 @@ void wasapi_stream_destroy(cubeb_stream * stm) unregister_notification_client(stm); if (stm->thread) { - SetEvent(stm->shutdown_event); - WaitForSingleObject(stm->thread, INFINITE); + BOOL ok = SetEvent(stm->shutdown_event); + if (!ok) { + LOG("Destroy SetEvent failed: %d\n", GetLastError()); + } + DWORD r = WaitForSingleObject(stm->thread, INFINITE); + if (r == WAIT_FAILED) { + LOG("Destroy WaitForSingleObject on thread failed: %d\n", GetLastError()); + } CloseHandle(stm->thread); stm->thread = 0; } @@ -1179,27 +1206,25 @@ void wasapi_stream_destroy(cubeb_stream * stm) int wasapi_stream_start(cubeb_stream * stm) { - HRESULT hr; - auto_lock lock(stm->stream_reset_lock); - assert(stm); + assert(stm && !stm->thread); stm->thread = (HANDLE) _beginthreadex(NULL, 256 * 1024, wasapi_stream_render_loop, stm, STACK_SIZE_PARAM_IS_A_RESERVATION, NULL); if (stm->thread == NULL) { - LOG("could not create WASAPI render thread."); + LOG("could not create WASAPI render thread.\n"); return CUBEB_ERROR; } - hr = stm->client->Start(); + HRESULT hr = stm->client->Start(); if (FAILED(hr)) { - LOG("could not start the stream."); + LOG("could not start the stream.\n"); return CUBEB_ERROR; + } else { + stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_STARTED); } - stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_STARTED); - - return CUBEB_OK; + return FAILED(hr) ? CUBEB_ERROR : CUBEB_OK; } int wasapi_stream_stop(cubeb_stream * stm) @@ -1208,23 +1233,31 @@ int wasapi_stream_stop(cubeb_stream * stm) auto_lock lock(stm->stream_reset_lock); - SetEvent(stm->shutdown_event); + BOOL ok = SetEvent(stm->shutdown_event); + if (!ok) { + LOG("Stop SetEvent failed: %d\n", GetLastError()); + } HRESULT hr = stm->client->Stop(); if (FAILED(hr)) { - LOG("could not stop AudioClient"); + LOG("could not stop AudioClient\n"); } if (stm->thread) { auto_unlock lock(stm->stream_reset_lock); - WaitForSingleObject(stm->thread, INFINITE); + DWORD r = WaitForSingleObject(stm->thread, INFINITE); + if (r == WAIT_FAILED) { + LOG("Stop WaitForSingleObject on thread failed: %d\n", GetLastError()); + } CloseHandle(stm->thread); stm->thread = NULL; } - stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_STOPPED); + if (SUCCEEDED(hr)) { + stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_STOPPED); + } - return CUBEB_OK; + return FAILED(hr) ? CUBEB_ERROR : CUBEB_OK; } int wasapi_stream_get_position(cubeb_stream * stm, uint64_t * position) @@ -1267,7 +1300,7 @@ int wasapi_stream_set_volume(cubeb_stream * stm, float volume) hr = stm->audio_stream_volume->GetChannelCount(&channels); if (hr != S_OK) { - LOG("could not get the channel count: %x", hr); + LOG("could not get the channel count: %x\n", hr); return CUBEB_ERROR; } @@ -1279,7 +1312,7 @@ int wasapi_stream_set_volume(cubeb_stream * stm, float volume) hr = stm->audio_stream_volume->SetAllVolumes(channels, volumes); if (hr != S_OK) { - LOG("coult not set the channels volume: %x", hr); + LOG("could not set the channels volume: %x\n", hr); return CUBEB_ERROR; } return CUBEB_OK; @@ -1303,6 +1336,5 @@ cubeb_ops const wasapi_ops = { /*.stream_get_current_device =*/ NULL, /*.stream_device_destroy =*/ NULL, /*.stream_register_device_changed_callback =*/ NULL - }; +}; } // namespace anonymous - diff --git a/media/libcubeb/src/cubeb_winmm.c b/media/libcubeb/src/cubeb_winmm.c index c438f647a040..1d0186924035 100644 --- a/media/libcubeb/src/cubeb_winmm.c +++ b/media/libcubeb/src/cubeb_winmm.c @@ -654,6 +654,10 @@ winmm_stream_get_latency(cubeb_stream * stm, uint32_t * latency) written = stm->written; LeaveCriticalSection(&stm->lock); + if (r != MMSYSERR_NOERROR || time.wType != TIME_SAMPLES) { + return CUBEB_ERROR; + } + *latency = written - time.u.sample; return CUBEB_OK; From 6af1b962faf20e9091f8edd84bb56b0597959589 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Tue, 17 Feb 2015 14:10:45 -0800 Subject: [PATCH 003/115] Bug 1133099 - Add window.navigator.mozE10sEnabled flag (r=jst) --- dom/base/Navigator.cpp | 14 ++++++++++++++ dom/base/Navigator.h | 4 ++++ dom/webidl/Navigator.webidl | 7 +++++++ 3 files changed, 25 insertions(+) diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index d10de70a4fee..27fc09586f84 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -2439,6 +2439,20 @@ Navigator::HasTVSupport(JSContext* aCx, JSObject* aGlobal) return status == nsIPrincipal::APP_STATUS_CERTIFIED; } +/* static */ +bool +Navigator::IsE10sEnabled(JSContext* aCx, JSObject* aGlobal) +{ + return XRE_GetProcessType() == GeckoProcessType_Content; +} + +bool +Navigator::MozE10sEnabled() +{ + // This will only be called if IsE10sEnabled() is true. + return true; +} + /* static */ already_AddRefed Navigator::GetWindowFromGlobal(JSObject* aGlobal) diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h index cc335425b5dd..09ba8e958a9e 100644 --- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -287,6 +287,8 @@ public: ErrorResult& aRv); void GetLanguages(nsTArray& aLanguages); + bool MozE10sEnabled(); + static void GetAcceptLanguages(nsTArray& aLanguages); // WebIDL helper methods @@ -315,6 +317,8 @@ public: static bool HasTVSupport(JSContext* aCx, JSObject* aGlobal); + static bool IsE10sEnabled(JSContext* aCx, JSObject* aGlobal); + nsPIDOMWindow* GetParentObject() const { return GetWindow(); diff --git a/dom/webidl/Navigator.webidl b/dom/webidl/Navigator.webidl index ccb5b8fdea01..e78a9a438590 100644 --- a/dom/webidl/Navigator.webidl +++ b/dom/webidl/Navigator.webidl @@ -420,3 +420,10 @@ partial interface Navigator { optional sequence supportedConfigurations); }; #endif + +#ifdef NIGHTLY_BUILD +partial interface Navigator { + [Func="Navigator::IsE10sEnabled"] + readonly attribute boolean mozE10sEnabled; +}; +#endif From 886bc07e58bd8a67278d3569319c175b0aebf6fe Mon Sep 17 00:00:00 2001 From: Robert Longson Date: Tue, 17 Feb 2015 22:15:15 +0000 Subject: [PATCH 004/115] Bug 1129854 - markers not oriented correctly for degenerate beziers. r=jwatt --- dom/svg/SVGPathData.cpp | 51 ++++++++----------- layout/reftests/svg/marker-orientation-04.svg | 39 ++++++++++++++ layout/reftests/svg/reftest.list | 1 + 3 files changed, 61 insertions(+), 30 deletions(-) create mode 100644 layout/reftests/svg/marker-orientation-04.svg diff --git a/dom/svg/SVGPathData.cpp b/dom/svg/SVGPathData.cpp index 1bf819a1f447..0e11782754f3 100644 --- a/dom/svg/SVGPathData.cpp +++ b/dom/svg/SVGPathData.cpp @@ -537,9 +537,9 @@ AngleOfVector(const Point& aVector) } static float -AngleOfVectorF(const Point& aVector) +AngleOfVector(const Point& cp1, const Point& cp2) { - return static_cast(AngleOfVector(aVector)); + return static_cast(AngleOfVector(cp1 - cp2)); } void @@ -573,7 +573,7 @@ SVGPathData::GetMarkerPositioningData(nsTArray *aMarks) const { case PATHSEG_CLOSEPATH: segEnd = pathStart; - segStartAngle = segEndAngle = AngleOfVectorF(segEnd - segStart); + segStartAngle = segEndAngle = AngleOfVector(segEnd, segStart); break; case PATHSEG_MOVETO_ABS: @@ -586,7 +586,7 @@ SVGPathData::GetMarkerPositioningData(nsTArray *aMarks) const pathStart = segEnd; // If authors are going to specify multiple consecutive moveto commands // with markers, me might as well make the angle do something useful: - segStartAngle = segEndAngle = AngleOfVectorF(segEnd - segStart); + segStartAngle = segEndAngle = AngleOfVector(segEnd, segStart); i += 2; break; @@ -597,7 +597,7 @@ SVGPathData::GetMarkerPositioningData(nsTArray *aMarks) const } else { segEnd = segStart + Point(mData[i], mData[i+1]); } - segStartAngle = segEndAngle = AngleOfVectorF(segEnd - segStart); + segStartAngle = segEndAngle = AngleOfVector(segEnd, segStart); i += 2; break; @@ -615,14 +615,10 @@ SVGPathData::GetMarkerPositioningData(nsTArray *aMarks) const segEnd = segStart + Point(mData[i+4], mData[i+5]); } prevCP = cp2; - if (cp1 == segStart) { - cp1 = cp2; - } - if (cp2 == segEnd) { - cp2 = cp1; - } - segStartAngle = AngleOfVectorF(cp1 - segStart); - segEndAngle = AngleOfVectorF(segEnd - cp2); + segStartAngle = + AngleOfVector(cp1 == segStart ? (cp1 == cp2 ? segEnd : cp2) : cp1, segStart); + segEndAngle = + AngleOfVector(segEnd, cp2 == segEnd ? (cp1 == cp2 ? segStart : cp1) : cp2); i += 6; break; } @@ -630,7 +626,7 @@ SVGPathData::GetMarkerPositioningData(nsTArray *aMarks) const case PATHSEG_CURVETO_QUADRATIC_ABS: case PATHSEG_CURVETO_QUADRATIC_REL: { - Point cp1, cp2; // control points + Point cp1; // control point if (segType == PATHSEG_CURVETO_QUADRATIC_ABS) { cp1 = Point(mData[i], mData[i+1]); segEnd = Point(mData[i+2], mData[i+3]); @@ -639,8 +635,8 @@ SVGPathData::GetMarkerPositioningData(nsTArray *aMarks) const segEnd = segStart + Point(mData[i+2], mData[i+3]); } prevCP = cp1; - segStartAngle = AngleOfVectorF(cp1 - segStart); - segEndAngle = AngleOfVectorF(segEnd - cp1); + segStartAngle = AngleOfVector(cp1 == segStart ? segEnd : cp1, segStart); + segEndAngle = AngleOfVector(segEnd, cp1 == segEnd ? segStart : cp1); i += 4; break; } @@ -680,7 +676,7 @@ SVGPathData::GetMarkerPositioningData(nsTArray *aMarks) const if (rx == 0.0 || ry == 0.0) { // F.6.6 step 1 - straight line or coincidental points - segStartAngle = segEndAngle = AngleOfVectorF(segEnd - segStart); + segStartAngle = segEndAngle = AngleOfVector(segEnd, segStart); i += 7; break; } @@ -755,7 +751,7 @@ SVGPathData::GetMarkerPositioningData(nsTArray *aMarks) const } else { segEnd = segStart + Point(mData[i++], 0.0f); } - segStartAngle = segEndAngle = AngleOfVectorF(segEnd - segStart); + segStartAngle = segEndAngle = AngleOfVector(segEnd, segStart); break; case PATHSEG_LINETO_VERTICAL_ABS: @@ -765,7 +761,7 @@ SVGPathData::GetMarkerPositioningData(nsTArray *aMarks) const } else { segEnd = segStart + Point(0.0f, mData[i++]); } - segStartAngle = segEndAngle = AngleOfVectorF(segEnd - segStart); + segStartAngle = segEndAngle = AngleOfVector(segEnd, segStart); break; case PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: @@ -782,14 +778,10 @@ SVGPathData::GetMarkerPositioningData(nsTArray *aMarks) const segEnd = segStart + Point(mData[i+2], mData[i+3]); } prevCP = cp2; - if (cp1 == segStart) { - cp1 = cp2; - } - if (cp2 == segEnd) { - cp2 = cp1; - } - segStartAngle = AngleOfVectorF(cp1 - segStart); - segEndAngle = AngleOfVectorF(segEnd - cp2); + segStartAngle = + AngleOfVector(cp1 == segStart ? (cp1 == cp2 ? segEnd : cp2) : cp1, segStart); + segEndAngle = + AngleOfVector(segEnd, cp2 == segEnd ? (cp1 == cp2 ? segStart : cp1) : cp2); i += 4; break; } @@ -799,15 +791,14 @@ SVGPathData::GetMarkerPositioningData(nsTArray *aMarks) const { Point cp1 = SVGPathSegUtils::IsQuadraticType(prevSegType) ? segStart * 2 - prevCP : segStart; - Point cp2; if (segType == PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS) { segEnd = Point(mData[i], mData[i+1]); } else { segEnd = segStart + Point(mData[i], mData[i+1]); } prevCP = cp1; - segStartAngle = AngleOfVectorF(cp1 - segStart); - segEndAngle = AngleOfVectorF(segEnd - cp1); + segStartAngle = AngleOfVector(cp1 == segStart ? segEnd : cp1, segStart); + segEndAngle = AngleOfVector(segEnd, cp1 == segEnd ? segStart : cp1); i += 2; break; } diff --git a/layout/reftests/svg/marker-orientation-04.svg b/layout/reftests/svg/marker-orientation-04.svg new file mode 100644 index 000000000000..3fb2fdd0b926 --- /dev/null +++ b/layout/reftests/svg/marker-orientation-04.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index 1c35d1478df1..cf80bb590278 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -201,6 +201,7 @@ fuzzy-if(cocoaWidget,15,19679) fuzzy-if(winWidget,1,8800) fuzzy-if(!cocoaWidget& == marker-orientation-01.svg marker-orientation-01-ref.svg pref(svg.marker-improvements.enabled,true) == marker-orientation-02.svg marker-orientation-02-ref.svg == marker-orientation-03.svg pass.svg +== marker-orientation-04.svg pass.svg == mask-basic-01.svg pass.svg == mask-basic-02.svg mask-basic-02-ref.svg == mask-basic-03.svg pass.svg From 02889442adaa2b34d6ad827849113a9b1f493e2b Mon Sep 17 00:00:00 2001 From: Masatoshi Kimura Date: Thu, 5 Feb 2015 22:44:10 +0900 Subject: [PATCH 005/115] Bug 1129756 - Revert test changes in bug 1041631 since Symbols are reenabled. r=jorendorff --- .../test/browser_webconsole_output_01.js | 39 ++- .../mochitest/general/test_interfaces.html | 7 +- dom/workers/test/test_worker_interfaces.js | 7 +- js/src/jit-test/tests/asm.js/testFFI.js | 6 +- js/src/jit-test/tests/asm.js/testGlobals.js | 8 +- js/src/jit-test/tests/basic/symbol-in-loop.js | 3 +- .../tests/debug/Debugger-debuggees-06.js | 3 +- .../tests/debug/Environment-names-02.js | 6 +- .../tests/debug/Frame-arguments-01.js | 4 +- .../tests/debug/Frame-evalWithBindings-02.js | 8 +- .../tests/debug/Frame-evalWithBindings-03.js | 3 +- js/src/jit-test/tests/debug/Frame-onPop-17.js | 3 +- js/src/jit-test/tests/debug/Frame-this-01.js | 8 +- js/src/jit-test/tests/debug/Frame-this-03.js | 8 +- .../debug/Object-getOwnPropertyNames-01.js | 12 +- .../debug/Object-getOwnPropertyNames-02.js | 3 +- .../debug/Object-makeDebuggeeValue-01.js | 6 +- js/src/jit-test/tests/gc/bug-1032206.js | 8 +- js/src/jit-test/tests/gc/bug-1035371.js | 3 +- js/src/jit-test/tests/gc/bug-1039516.js | 14 +- .../jit-test/tests/heap-analysis/findPath.js | 12 +- js/src/jit-test/tests/ion/bug1054753.js | 25 +- js/src/jit-test/tests/pic/watch5.js | 46 ++-- .../proxy/testDirectProxyDefineProperty1.js | 5 +- .../proxy/testDirectProxyDefineProperty2.js | 8 +- .../tests/proxy/testDirectProxyGet1.js | 12 +- .../tests/proxy/testDirectProxyGet2.js | 5 +- .../tests/proxy/testDirectProxyGet5.js | 12 +- .../testDirectProxyGetOwnPropertyNames1.js | 3 +- .../tests/proxy/testDirectProxyHas1.js | 3 +- .../tests/proxy/testDirectProxyHas2.js | 5 +- .../tests/proxy/testDirectProxyHas6.js | 3 +- .../proxy/testDirectProxyHasOwnProperty.js | 11 +- .../tests/proxy/testDirectProxySet1.js | 12 +- .../tests/proxy/testDirectProxySet2.js | 5 +- .../tests/proxy/testDirectProxySet3.js | 5 +- .../jit-test/tests/self-test/assertDeepEq.js | 34 ++- js/src/jit-test/tests/symbol/bug-1033856.js | 8 +- js/src/jit-test/tests/symbol/not.js | 6 +- js/src/jit-test/tests/symbol/toNumber.js | 34 ++- js/src/jit-test/tests/symbol/toString.js | 16 +- js/src/jit-test/tests/symbol/truthiness.js | 6 +- js/src/jit-test/tests/symbol/typed-arrays.js | 46 ++-- js/src/jit-test/tests/symbol/typeof.js | 15 +- js/src/tests/ecma_6/Class/compPropNames.js | 22 +- js/src/tests/ecma_6/Class/methDefn.js | 10 +- js/src/tests/ecma_6/Map/symbols.js | 50 ++-- js/src/tests/ecma_6/Object/assign.js | 3 +- .../Object/getOwnPropertySymbols-proxy.js | 16 +- .../ecma_6/Object/getOwnPropertySymbols.js | 74 +++--- js/src/tests/ecma_6/Set/symbols.js | 40 ++- js/src/tests/ecma_6/Symbol/as-base-value.js | 160 ++++++------ js/src/tests/ecma_6/Symbol/comparisons.js | 46 ++-- js/src/tests/ecma_6/Symbol/constructor.js | 50 ++-- js/src/tests/ecma_6/Symbol/conversions.js | 106 ++++---- .../tests/ecma_6/Symbol/enumeration-order.js | 33 ++- js/src/tests/ecma_6/Symbol/enumeration.js | 86 +++---- js/src/tests/ecma_6/Symbol/equality.js | 42 ++- js/src/tests/ecma_6/Symbol/errors.js | 18 +- js/src/tests/ecma_6/Symbol/for-in-order.js | 50 ++-- js/src/tests/ecma_6/Symbol/for.js | 42 ++- .../ecma_6/Symbol/json-stringify-keys.js | 24 +- .../ecma_6/Symbol/json-stringify-values.js | 46 ++-- js/src/tests/ecma_6/Symbol/keyFor.js | 16 +- .../tests/ecma_6/Symbol/property-accessor.js | 60 +++-- js/src/tests/ecma_6/Symbol/property-basics.js | 66 +++-- .../ecma_6/Symbol/property-inheritance.js | 77 +++--- .../ecma_6/Symbol/property-nonwritable.js | 29 +-- .../ecma_6/Symbol/property-reflection.js | 239 +++++++++--------- js/src/tests/ecma_6/Symbol/realms.js | 52 ++-- js/src/tests/ecma_6/Symbol/surfaces.js | 48 ++-- js/src/tests/ecma_6/Symbol/toString.js | 40 ++- js/src/tests/ecma_6/Symbol/typed-arrays.js | 18 +- js/src/tests/ecma_6/Symbol/typeof.js | 10 +- js/src/tests/ecma_6/Symbol/valueOf.js | 30 +-- js/src/tests/ecma_6/Symbol/well-known.js | 22 +- js/src/tests/ecma_6/WeakMap/symbols.js | 10 +- js/src/tests/ecma_6/shell.js | 1 + .../extensions/noSuchMethod-symbols.js | 28 +- .../object-toSource-with-symbol-keys.js | 18 +- .../tests/js1_8_5/extensions/symbol-uneval.js | 14 +- toolkit/devtools/server/actors/script.js | 2 +- .../server/tests/unit/test_symbols-01.js | 6 - .../server/tests/unit/test_symbols-02.js | 6 - 84 files changed, 1005 insertions(+), 1201 deletions(-) diff --git a/browser/devtools/webconsole/test/browser_webconsole_output_01.js b/browser/devtools/webconsole/test/browser_webconsole_output_01.js index 12e96a992b92..f9ec8ff381e7 100644 --- a/browser/devtools/webconsole/test/browser_webconsole_output_01.js +++ b/browser/devtools/webconsole/test/browser_webconsole_output_01.js @@ -82,29 +82,26 @@ let inputTests = [ output: "/foobar/", inspectable: true, }, + + // 9 + { + input: "Symbol()", + output: "Symbol()" + }, + + // 10 + { + input: "Symbol('foo')", + output: "Symbol(foo)" + }, + + // 11 + { + input: "Symbol.iterator", + output: "Symbol(Symbol.iterator)" + }, ]; -if (typeof Symbol !== "undefined") { - inputTests.push( - // 9 - { - input: "Symbol()", - output: "Symbol()" - }, - - // 10 - { - input: "Symbol('foo')", - output: "Symbol(foo)" - }, - - // 11 - { - input: "Symbol.iterator", - output: "Symbol(Symbol.iterator)" - }); -} - longString = initialString = null; function test() { diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index ddafcfaa3dfc..ca962016b45c 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -88,6 +88,7 @@ var ecmaGlobals = {name: "Atomics", nightly: true}, "StopIteration", "String", + "Symbol", "SyntaxError", {name: "TypedObject", nightly: true}, "TypeError", @@ -102,12 +103,6 @@ var ecmaGlobals = // IMPORTANT: Do not change the list above without review from // a JavaScript Engine peer! -// Symbol is conditionally defined. -// If it's defined, insert "Symbol" before "SyntaxError". -if (typeof Symbol === "function") { - ecmaGlobals.splice(ecmaGlobals.indexOf("SyntaxError"), 0, "Symbol"); -} - // IMPORTANT: Do not change the list below without review from a DOM peer, // except to remove items from it! // diff --git a/dom/workers/test/test_worker_interfaces.js b/dom/workers/test/test_worker_interfaces.js index 00eb7e6635c3..7db8c465becf 100644 --- a/dom/workers/test/test_worker_interfaces.js +++ b/dom/workers/test/test_worker_interfaces.js @@ -62,6 +62,7 @@ var ecmaGlobals = {name: "Atomics", nightly: true}, "StopIteration", "String", + "Symbol", "SyntaxError", {name: "TypedObject", nightly: true}, "TypeError", @@ -76,12 +77,6 @@ var ecmaGlobals = // IMPORTANT: Do not change the list above without review from // a JavaScript Engine peer! -// Symbol is conditionally defined. -// If it's defined, insert "Symbol" before "SyntaxError". -if (typeof Symbol === "function") { - ecmaGlobals.splice(ecmaGlobals.indexOf("SyntaxError"), 0, "Symbol"); -} - // IMPORTANT: Do not change the list below without review from a DOM peer! var interfaceNamesInGlobalScope = [ diff --git a/js/src/jit-test/tests/asm.js/testFFI.js b/js/src/jit-test/tests/asm.js/testFFI.js index dc219452a4fe..549e2f2e8e33 100644 --- a/js/src/jit-test/tests/asm.js/testFFI.js +++ b/js/src/jit-test/tests/asm.js/testFFI.js @@ -151,10 +151,8 @@ assertEq(f(40), INT32_MAX + 1 | 0); function testBadConversions(f) { valueToConvert = {valueOf: function () { throw "FAIL"; }}; assertThrowsValue(() => f(40), "FAIL"); - if (typeof Symbol === "function") { - valueToConvert = Symbol(); - assertThrowsInstanceOf(() => f(40), TypeError); - } + valueToConvert = Symbol(); + assertThrowsInstanceOf(() => f(40), TypeError); } testBadConversions(f); diff --git a/js/src/jit-test/tests/asm.js/testGlobals.js b/js/src/jit-test/tests/asm.js/testGlobals.js index e1b8de79017c..e47ef4e71961 100644 --- a/js/src/jit-test/tests/asm.js/testGlobals.js +++ b/js/src/jit-test/tests/asm.js/testGlobals.js @@ -116,11 +116,9 @@ assertAsmLinkFail(asmCompile('glob','foreign', USE_ASM + 'var i = foreign.x|0; f assertEq(asmLink(asmCompile('glob','foreign', USE_ASM + 'var i = foreign.x|0; function f() { return i|0} return f'), null, {x:"blah"})(), 0); assertEq(asmLink(asmCompile('glob','foreign', USE_ASM + 'var i = +foreign.x; function f() { return +i} return f'), null, {x:"blah"})(), NaN); assertEq(asmLink(asmCompile('glob','foreign', USE_ASM + 'var tof = glob.Math.fround; var i = tof(foreign.x); function f() { return +i} return f'), this, {x:"blah"})(), NaN); -if (typeof Symbol === "function") { - assertThrowsInstanceOf(() => asmCompile('glob','foreign',USE_ASM + 'var i = foreign.x|0; function f() { return i|0} return f')(null, {x:Symbol("blah")}), TypeError); - assertThrowsInstanceOf(() => asmCompile('glob','foreign',USE_ASM + 'var i = +foreign.x; function f() { return +i} return f')(null, {x:Symbol("blah")}), TypeError); - assertThrowsInstanceOf(() => asmCompile('glob','foreign',USE_ASM + 'var tof = glob.Math.fround; var i = tof(foreign.x); function f() { return +i} return f')(this, {x:Symbol("blah")}), TypeError); -} +assertThrowsInstanceOf(() => asmCompile('glob','foreign',USE_ASM + 'var i = foreign.x|0; function f() { return i|0} return f')(null, {x:Symbol("blah")}), TypeError); +assertThrowsInstanceOf(() => asmCompile('glob','foreign',USE_ASM + 'var i = +foreign.x; function f() { return +i} return f')(null, {x:Symbol("blah")}), TypeError); +assertThrowsInstanceOf(() => asmCompile('glob','foreign',USE_ASM + 'var tof = glob.Math.fround; var i = tof(foreign.x); function f() { return +i} return f')(this, {x:Symbol("blah")}), TypeError); // Temporary workaround; this test can be removed when Emscripten is fixed and // the fix has propagated out to most apps: diff --git a/js/src/jit-test/tests/basic/symbol-in-loop.js b/js/src/jit-test/tests/basic/symbol-in-loop.js index e1aafa2912be..cddef52655c5 100644 --- a/js/src/jit-test/tests/basic/symbol-in-loop.js +++ b/js/src/jit-test/tests/basic/symbol-in-loop.js @@ -1,6 +1,5 @@ function f() { - if (typeof Symbol === "function") - return Object(Symbol()); + return Object(Symbol()); } for (var i = 0; i < 4; i++) { diff --git a/js/src/jit-test/tests/debug/Debugger-debuggees-06.js b/js/src/jit-test/tests/debug/Debugger-debuggees-06.js index f27d926b63c6..39e00f484836 100644 --- a/js/src/jit-test/tests/debug/Debugger-debuggees-06.js +++ b/js/src/jit-test/tests/debug/Debugger-debuggees-06.js @@ -17,8 +17,7 @@ check(false); check(1); check(NaN); check("ok"); -if (typeof Symbol === "function") - check(Symbol("ok")); +check(Symbol("ok")); // A Debugger.Object that belongs to a different Debugger object is invalid. var g = newGlobal(); diff --git a/js/src/jit-test/tests/debug/Environment-names-02.js b/js/src/jit-test/tests/debug/Environment-names-02.js index 4ca811999a57..982043f63b44 100644 --- a/js/src/jit-test/tests/debug/Environment-names-02.js +++ b/js/src/jit-test/tests/debug/Environment-names-02.js @@ -18,8 +18,7 @@ g.eval("" + obj[" "] = 3; obj[""] = 4; obj[0] = 5; - if (typeof Symbol === "function") - obj[Symbol.for("moon")] = 6; + obj[Symbol.for("moon")] = 6; return obj; }) g.eval("fill(this);\n" + @@ -31,6 +30,5 @@ for (var names of [withNames, globalNames]) { assertEq(names.indexOf(" "), -1); assertEq(names.indexOf(""), -1); assertEq(names.indexOf("0"), -1); - if (typeof Symbol === "function") - assertEq(names.indexOf(Symbol.for("moon")), -1); + assertEq(names.indexOf(Symbol.for("moon")), -1); } diff --git a/js/src/jit-test/tests/debug/Frame-arguments-01.js b/js/src/jit-test/tests/debug/Frame-arguments-01.js index b3d3d846df6f..9cf6b7dfdf82 100644 --- a/js/src/jit-test/tests/debug/Frame-arguments-01.js +++ b/js/src/jit-test/tests/debug/Frame-arguments-01.js @@ -22,9 +22,7 @@ g.eval("function f() { debugger; }"); hits = 0; g.eval("args = []; f();"); g.eval("this.f();"); -g.eval("var world = 'world'; " + - "if (typeof Symbol === 'function') " + - " Symbol('world'); " + +g.eval("var world = Symbol('world'); " + "args = ['hello', world, 3.14, true, false, null, undefined]; " + "f('hello', world, 3.14, true, false, null, undefined);"); g.eval("f.apply(undefined, args);"); diff --git a/js/src/jit-test/tests/debug/Frame-evalWithBindings-02.js b/js/src/jit-test/tests/debug/Frame-evalWithBindings-02.js index 5ca9689cd4a4..248aa8a20efa 100644 --- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-02.js +++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-02.js @@ -15,9 +15,7 @@ g.eval("function f(obj, expected) { debugger; }"); g.eval("f(new Number(-0), '0');"); g.eval("f(new String('ok'), 'ok');"); -if (typeof Symbol === "function") { - g.eval("f(Symbol('still ok'), 'Symbol(still ok)');"); - g.eval("f(Object(Symbol('still ok')), 'Symbol(still ok)');"); -} +g.eval("f(Symbol('still ok'), 'Symbol(still ok)');"); +g.eval("f(Object(Symbol('still ok')), 'Symbol(still ok)');"); g.eval("f({toString: function () { return f; }}, f);"); -assertEq(hits, typeof Symbol === "function" ? 5 : 3); +assertEq(hits, 5); diff --git a/js/src/jit-test/tests/debug/Frame-evalWithBindings-03.js b/js/src/jit-test/tests/debug/Frame-evalWithBindings-03.js index 204c28a8052b..f3a3e4185a87 100644 --- a/js/src/jit-test/tests/debug/Frame-evalWithBindings-03.js +++ b/js/src/jit-test/tests/debug/Frame-evalWithBindings-03.js @@ -12,6 +12,5 @@ dbg.onDebuggerStatement = function (frame) { hits++; }; g.eval("function f() { debugger; }"); -var symbolExpr = typeof Symbol === "function" ? "Symbol('alpha')" : "'alpha'"; -g.eval("f(undefined, -0, NaN, '\uffff', " + symbolExpr + ", Array.prototype, Math, f);"); +g.eval("f(undefined, -0, NaN, '\uffff', Symbol('alpha'), Array.prototype, Math, f);"); assertEq(hits, 1); diff --git a/js/src/jit-test/tests/debug/Frame-onPop-17.js b/js/src/jit-test/tests/debug/Frame-onPop-17.js index a5651af0f1c8..5cb382403775 100644 --- a/js/src/jit-test/tests/debug/Frame-onPop-17.js +++ b/js/src/jit-test/tests/debug/Frame-onPop-17.js @@ -23,8 +23,7 @@ test(null); test(false); test(1); test("stringy"); -if (typeof Symbol === "function") - test(Symbol("symbolic")); +test(Symbol("symbolic")); test({}); test([]); diff --git a/js/src/jit-test/tests/debug/Frame-this-01.js b/js/src/jit-test/tests/debug/Frame-this-01.js index 6b526592548e..3a610a7c5174 100644 --- a/js/src/jit-test/tests/debug/Frame-this-01.js +++ b/js/src/jit-test/tests/debug/Frame-this-01.js @@ -16,11 +16,9 @@ g.eval("Number.prototype.f = f; v = 3.14; v.f();"); g.eval("f.call(v);"); g.eval("String.prototype.f = f; v = 'hello'; v.f();"); g.eval("f.call(v);"); -if (typeof Symbol === "function") { - g.eval("Symbol.prototype.f = f; v = Symbol('world'); v.f();"); - g.eval("f.call(v);"); -} +g.eval("Symbol.prototype.f = f; v = Symbol('world'); v.f();"); +g.eval("f.call(v);"); g.eval("v = undefined; f.call(v);"); g.eval("v = null; f.call(v);"); -assertEq(hits, typeof Symbol === "function" ? 10 : 8); +assertEq(hits, 10); diff --git a/js/src/jit-test/tests/debug/Frame-this-03.js b/js/src/jit-test/tests/debug/Frame-this-03.js index 93fe3f6874c8..fbd55c6e00fb 100644 --- a/js/src/jit-test/tests/debug/Frame-this-03.js +++ b/js/src/jit-test/tests/debug/Frame-this-03.js @@ -21,11 +21,9 @@ g.eval("Number.prototype.f = f; v = 3.14; v.f();"); g.eval("f.call(v);"); g.eval("String.prototype.f = f; v = 'hello'; v.f();"); g.eval("f.call(v);"); -if (typeof Symbol === "function") { - g.eval("Symbol.prototype.f = f; v = Symbol('world'); v.f();"); - g.eval("f.call(v);"); -} +g.eval("Symbol.prototype.f = f; v = Symbol('world'); v.f();"); +g.eval("f.call(v);"); g.eval("v = undefined; f.call(v);"); g.eval("v = null; f.call(v);"); -assertEq(hits, typeof Symbol === "function" ? 10 : 8); +assertEq(hits, 10); diff --git a/js/src/jit-test/tests/debug/Object-getOwnPropertyNames-01.js b/js/src/jit-test/tests/debug/Object-getOwnPropertyNames-01.js index 3888dd613a45..9637e1ee0f9c 100644 --- a/js/src/jit-test/tests/debug/Object-getOwnPropertyNames-01.js +++ b/js/src/jit-test/tests/debug/Object-getOwnPropertyNames-01.js @@ -26,10 +26,8 @@ test("[0, 1, 2]"); test("[,,,,,]"); test("/a*a/"); test("function () {}"); -if (typeof Symbol === "function") { - test("(function () {\n" + - " var x = {};\n" + - " x[Symbol()] = 1; x[Symbol.for('moon')] = 2; x[Symbol.iterator] = 3;\n" + - " return x;\n" + - "})()"); -} +test("(function () {\n" + + " var x = {};\n" + + " x[Symbol()] = 1; x[Symbol.for('moon')] = 2; x[Symbol.iterator] = 3;\n" + + " return x;\n" + + "})()"); diff --git a/js/src/jit-test/tests/debug/Object-getOwnPropertyNames-02.js b/js/src/jit-test/tests/debug/Object-getOwnPropertyNames-02.js index 543d1af93f7e..bf0db28be2b3 100644 --- a/js/src/jit-test/tests/debug/Object-getOwnPropertyNames-02.js +++ b/js/src/jit-test/tests/debug/Object-getOwnPropertyNames-02.js @@ -4,8 +4,7 @@ var g = newGlobal(); var dbg = Debugger(); var gobj = dbg.addDebuggee(g); g.p = {xyzzy: 8}; // makes a cross-compartment wrapper -if (typeof Symbol === "function") - g.p[Symbol.for("plugh")] = 9; +g.p[Symbol.for("plugh")] = 9; var wp = gobj.getOwnPropertyDescriptor("p").value; var names = wp.getOwnPropertyNames(); assertEq(names.length, 1); diff --git a/js/src/jit-test/tests/debug/Object-makeDebuggeeValue-01.js b/js/src/jit-test/tests/debug/Object-makeDebuggeeValue-01.js index d1cdcea948c9..5537150e3711 100644 --- a/js/src/jit-test/tests/debug/Object-makeDebuggeeValue-01.js +++ b/js/src/jit-test/tests/debug/Object-makeDebuggeeValue-01.js @@ -38,7 +38,5 @@ assertEq(gw.makeDebuggeeValue(null), null); assertEq(gw.makeDebuggeeValue(1729), 1729); assertEq(gw.makeDebuggeeValue(Math.PI), Math.PI); assertEq(gw.makeDebuggeeValue(undefined), undefined); -if (typeof Symbol === "function") { - var s = g.eval("Symbol('Stavromula Beta')"); - assertEq(gw.makeDebuggeeValue(s), s); -} +var s = g.eval("Symbol('Stavromula Beta')"); +assertEq(gw.makeDebuggeeValue(s), s); diff --git a/js/src/jit-test/tests/gc/bug-1032206.js b/js/src/jit-test/tests/gc/bug-1032206.js index ec743f3439dd..c58cc53a8d3d 100644 --- a/js/src/jit-test/tests/gc/bug-1032206.js +++ b/js/src/jit-test/tests/gc/bug-1032206.js @@ -1,5 +1,3 @@ -if (typeof Symbol === "function") { - gczeal(4); - var symbols = [Symbol(), Symbol("comet"), Symbol.for("moon"), Symbol.iterator, 0]; - for (var a of symbols) {} -} +gczeal(4); +var symbols = [Symbol(), Symbol("comet"), Symbol.for("moon"), Symbol.iterator, 0]; +for (var a of symbols) {} diff --git a/js/src/jit-test/tests/gc/bug-1035371.js b/js/src/jit-test/tests/gc/bug-1035371.js index d5200d92b5e0..b42a74656d2b 100644 --- a/js/src/jit-test/tests/gc/bug-1035371.js +++ b/js/src/jit-test/tests/gc/bug-1035371.js @@ -1,5 +1,4 @@ x = function() {}; y = new WeakMap; selectforgc({});; -if (typeof Symbol === "function") - y.set(x, Symbol()); +y.set(x, Symbol()); diff --git a/js/src/jit-test/tests/gc/bug-1039516.js b/js/src/jit-test/tests/gc/bug-1039516.js index 996e8234501f..15f2a994d9bf 100644 --- a/js/src/jit-test/tests/gc/bug-1039516.js +++ b/js/src/jit-test/tests/gc/bug-1039516.js @@ -1,8 +1,6 @@ -if (typeof Symbol === "function") { - gczeal(9); - Symbol.for("a"); - gcslice(1); - var a = Symbol.for("a"); - gcslice(); - print(Symbol.keyFor(a)); -} +gczeal(9); +Symbol.for("a"); +gcslice(1); +var a = Symbol.for("a"); +gcslice(); +print(Symbol.keyFor(a)); diff --git a/js/src/jit-test/tests/heap-analysis/findPath.js b/js/src/jit-test/tests/heap-analysis/findPath.js index b26bf13953f0..e4f556a09f5c 100644 --- a/js/src/jit-test/tests/heap-analysis/findPath.js +++ b/js/src/jit-test/tests/heap-analysis/findPath.js @@ -42,10 +42,8 @@ Match.Pattern([{node: {}, edge: "shape"}, .assert(findPath(o, o)); print(findPath(o, o).map((e) => e.edge).toString()); -if (typeof Symbol === "function") { - // Check that we can generate ubi::Nodes for Symbols. - var so = { sym: Symbol() }; - Match.Pattern([{node: {}, edge: "sym" }]) - .assert(findPath(so, so.sym)); - print(findPath(so, so.sym).map((e) => e.edge).toString()); -} +// Check that we can generate ubi::Nodes for Symbols. +var so = { sym: Symbol() }; +Match.Pattern([{node: {}, edge: "sym" }]) + .assert(findPath(so, so.sym)); +print(findPath(so, so.sym).map((e) => e.edge).toString()); diff --git a/js/src/jit-test/tests/ion/bug1054753.js b/js/src/jit-test/tests/ion/bug1054753.js index 1c09352bba4f..a05f2be5024b 100644 --- a/js/src/jit-test/tests/ion/bug1054753.js +++ b/js/src/jit-test/tests/ion/bug1054753.js @@ -1,16 +1,13 @@ // |jit-test| error: TypeError -if (typeof Symbol === "function") { - g = (function() { - var Int32ArrayView = new Int32Array(); - function f() { - Int32ArrayView[Symbol() >> 2] - } - return f; - })(); - try { - g(); - } catch (e) {} +g = (function() { + var Int32ArrayView = new Int32Array(); + function f() { + Int32ArrayView[Symbol() >> 2] + } + return f; +})(); +try { g(); -} else { - throw new TypeError("pass"); -} +} catch (e) {} +g(); + diff --git a/js/src/jit-test/tests/pic/watch5.js b/js/src/jit-test/tests/pic/watch5.js index afca3fbb35fb..6b22951a4af0 100644 --- a/js/src/jit-test/tests/pic/watch5.js +++ b/js/src/jit-test/tests/pic/watch5.js @@ -1,29 +1,27 @@ // test against future pic support for symbols -if (typeof Symbol === "function") { - // assignments to watched objects must not be cached - var obj = {}; - var x = Symbol.for("x"); - obj[x] = 0; - var hits = 0; - obj.watch(x, function (id, oldval, newval) { hits++; return newval; }); - for (var i = 0; i < 10; i++) - obj[x] = i; - assertEq(hits, 10); +// assignments to watched objects must not be cached +var obj = {}; +var x = Symbol.for("x"); +obj[x] = 0; +var hits = 0; +obj.watch(x, function (id, oldval, newval) { hits++; return newval; }); +for (var i = 0; i < 10; i++) + obj[x] = i; +assertEq(hits, 10); - // assignments to watched properties via ++ must not be cached - hits = 0; - for (var i = 0; i < 10; i++) - obj[x]++; - assertEq(hits, 10); +// assignments to watched properties via ++ must not be cached +hits = 0; +for (var i = 0; i < 10; i++) + obj[x]++; +assertEq(hits, 10); - // adding assignment + watchpoint vs. caching - hits = 0; - obj = {}; - obj.watch(x, function (id, oldval, newval) { hits++; return newval; }); - for (var i = 0; i < 10; i++) { - obj[x] = 1; - delete obj[x]; - } - assertEq(hits, 10); +// adding assignment + watchpoint vs. caching +hits = 0; +obj = {}; +obj.watch(x, function (id, oldval, newval) { hits++; return newval; }); +for (var i = 0; i < 10; i++) { + obj[x] = 1; + delete obj[x]; } +assertEq(hits, 10); diff --git a/js/src/jit-test/tests/proxy/testDirectProxyDefineProperty1.js b/js/src/jit-test/tests/proxy/testDirectProxyDefineProperty1.js index 12fe7f1eb12e..243ad55a1349 100644 --- a/js/src/jit-test/tests/proxy/testDirectProxyDefineProperty1.js +++ b/js/src/jit-test/tests/proxy/testDirectProxyDefineProperty1.js @@ -15,10 +15,7 @@ function testProxy(p, key) { assertEq(desc.configurable, true); } -var keys = ['foo']; -if (typeof Symbol === "function") - keys.push(Symbol("quux")); -for (var key of keys) { +for (var key of ['foo', Symbol("quux")]) { target = {}; testProxy(new Proxy(target, {}), key); target = {}; diff --git a/js/src/jit-test/tests/proxy/testDirectProxyDefineProperty2.js b/js/src/jit-test/tests/proxy/testDirectProxyDefineProperty2.js index 6cc15b0b8966..cc322176bab1 100644 --- a/js/src/jit-test/tests/proxy/testDirectProxyDefineProperty2.js +++ b/js/src/jit-test/tests/proxy/testDirectProxyDefineProperty2.js @@ -23,15 +23,11 @@ var desc = { configurable: true }; -function quux() { - return typeof Symbol === "function" ? Symbol.for('quux') : 'quux'; -} - for (let p of [new Proxy(target, handler), Proxy.revocable(target, handler).proxy]) { var log = []; Object.defineProperty(p, 'foo', desc); - Object.defineProperty(p, quux(), desc); + Object.defineProperty(p, Symbol.for('quux'), desc); assertEq(log.length, 2); assertEq(log[0], 'foo'); - assertEq(log[1], quux()); + assertEq(log[1], Symbol.for('quux')); } diff --git a/js/src/jit-test/tests/proxy/testDirectProxyGet1.js b/js/src/jit-test/tests/proxy/testDirectProxyGet1.js index d7bf336cb329..43cb5385d044 100644 --- a/js/src/jit-test/tests/proxy/testDirectProxyGet1.js +++ b/js/src/jit-test/tests/proxy/testDirectProxyGet1.js @@ -5,10 +5,8 @@ for (let p of [new Proxy(target, {}), Proxy.revocable(target, {}).proxy]) { assertEq(p['foo'], 'bar'); } -if (typeof Symbol === "function") { - var s = Symbol.for("moon"); - var obj = {}; - obj[s] = "dust"; - for (let p of [new Proxy(obj, {}), Proxy.revocable(obj, {}).proxy]) - assertEq(p[s], "dust"); -} +var s = Symbol.for("moon"); +var obj = {}; +obj[s] = "dust"; +for (let p of [new Proxy(obj, {}), Proxy.revocable(obj, {}).proxy]) + assertEq(p[s], "dust"); diff --git a/js/src/jit-test/tests/proxy/testDirectProxyGet2.js b/js/src/jit-test/tests/proxy/testDirectProxyGet2.js index d86a618b7344..ab3efae32289 100644 --- a/js/src/jit-test/tests/proxy/testDirectProxyGet2.js +++ b/js/src/jit-test/tests/proxy/testDirectProxyGet2.js @@ -4,10 +4,7 @@ * as the third argument */ var target = {}; -var keys = ['foo']; -if (typeof Symbol === "function") - keys.push(Symbol.iterator); -for (var key of keys) { +for (var key of ['foo', Symbol.iterator]) { handler = {}; for (let p of [new Proxy(target, handler), Proxy.revocable(target, handler).proxy]) { handler.get = diff --git a/js/src/jit-test/tests/proxy/testDirectProxyGet5.js b/js/src/jit-test/tests/proxy/testDirectProxyGet5.js index c0590a801bda..a71a36e80b07 100644 --- a/js/src/jit-test/tests/proxy/testDirectProxyGet5.js +++ b/js/src/jit-test/tests/proxy/testDirectProxyGet5.js @@ -1,9 +1,7 @@ // Return the trap result var target = { foo: 'bar' }; -if (typeof Symbol === "function") { - var s1 = Symbol("moon"), s2 = Symbol("sun"); - target[s1] = "wrong"; -} +var s1 = Symbol("moon"), s2 = Symbol("sun"); +target[s1] = "wrong"; var handler = { }; for (let p of [new Proxy(target, handler), Proxy.revocable(target, handler).proxy]) { @@ -13,8 +11,6 @@ for (let p of [new Proxy(target, handler), Proxy.revocable(target, handler).prox handler.get = (() => undefined); assertEq(p.foo, undefined); - if (typeof Symbol === "function") { - handler.get = (() => s2); - assertEq(p[s1], s2); - } + handler.get = (() => s2); + assertEq(p[s1], s2); } diff --git a/js/src/jit-test/tests/proxy/testDirectProxyGetOwnPropertyNames1.js b/js/src/jit-test/tests/proxy/testDirectProxyGetOwnPropertyNames1.js index d15d75633843..11618c876f10 100644 --- a/js/src/jit-test/tests/proxy/testDirectProxyGetOwnPropertyNames1.js +++ b/js/src/jit-test/tests/proxy/testDirectProxyGetOwnPropertyNames1.js @@ -21,8 +21,7 @@ var objCD = Object.create(objAB, { } }); -if (typeof Symbol === "function") - objCD[Symbol("moon")] = "something"; +objCD[Symbol("moon")] = "something"; for (let p of [new Proxy(objCD, {}), Proxy.revocable(objCD, {}).proxy]) { var names = Object.getOwnPropertyNames(p); assertEq(names.length, 2); diff --git a/js/src/jit-test/tests/proxy/testDirectProxyHas1.js b/js/src/jit-test/tests/proxy/testDirectProxyHas1.js index 4efd496da487..0e46d03e8863 100644 --- a/js/src/jit-test/tests/proxy/testDirectProxyHas1.js +++ b/js/src/jit-test/tests/proxy/testDirectProxyHas1.js @@ -14,6 +14,5 @@ for (let p of [new Proxy(target, {}), Proxy.revocable(target, {}).proxy]) { assertEq('foo' in p, true); assertEq('bar' in p, true); assertEq('baz' in p, false); - if (typeof Symbol === "function") - assertEq(Symbol() in p, false); + assertEq(Symbol() in p, false); } diff --git a/js/src/jit-test/tests/proxy/testDirectProxyHas2.js b/js/src/jit-test/tests/proxy/testDirectProxyHas2.js index bbbb9c0e32bb..a1aba55dfb54 100644 --- a/js/src/jit-test/tests/proxy/testDirectProxyHas2.js +++ b/js/src/jit-test/tests/proxy/testDirectProxyHas2.js @@ -3,10 +3,7 @@ * argument, and the name of the property as the second argument */ var target = {}; -var keys = ['foo']; -if (typeof Symbol === "function") - keys.push(Symbol('bar')); -for (var key of keys) { +for (var key of ['foo', Symbol('bar')]) { var called; var handler = { has: function (target1, name) { diff --git a/js/src/jit-test/tests/proxy/testDirectProxyHas6.js b/js/src/jit-test/tests/proxy/testDirectProxyHas6.js index c4de2aec47f1..179e40f86fe8 100644 --- a/js/src/jit-test/tests/proxy/testDirectProxyHas6.js +++ b/js/src/jit-test/tests/proxy/testDirectProxyHas6.js @@ -9,6 +9,5 @@ var handler = { has: () => false }; for (let p of [new Proxy(target, handler), Proxy.revocable(target, handler).proxy]) { assertEq('foo' in p, false); - if (typeof Symbol === "function") - assertEq(Symbol.iterator in p, false); + assertEq(Symbol.iterator in p, false); } diff --git a/js/src/jit-test/tests/proxy/testDirectProxyHasOwnProperty.js b/js/src/jit-test/tests/proxy/testDirectProxyHasOwnProperty.js index 4df56dc7b36a..5b7a97bba963 100644 --- a/js/src/jit-test/tests/proxy/testDirectProxyHasOwnProperty.js +++ b/js/src/jit-test/tests/proxy/testDirectProxyHasOwnProperty.js @@ -9,19 +9,16 @@ var descs = { configurable: true } }; -if (typeof Symbol === "function") - descs[Symbol.for("quux")] = {configurable: true}; +descs[Symbol.for("quux")] = {configurable: true}; var target = Object.create(proto, descs); for (let p of [new Proxy(target, {}), Proxy.revocable(target, {}).proxy]) { assertEq(({}).hasOwnProperty.call(p, 'foo'), false); assertEq(({}).hasOwnProperty.call(p, 'bar'), true); assertEq(({}).hasOwnProperty.call(p, 'quux'), false); - if (typeof Symbol === "function") { - assertEq(({}).hasOwnProperty.call(p, Symbol('quux')), false); - assertEq(({}).hasOwnProperty.call(p, 'Symbol(quux)'), false); - assertEq(({}).hasOwnProperty.call(p, Symbol.for('quux')), true); - } + assertEq(({}).hasOwnProperty.call(p, Symbol('quux')), false); + assertEq(({}).hasOwnProperty.call(p, 'Symbol(quux)'), false); + assertEq(({}).hasOwnProperty.call(p, Symbol.for('quux')), true); } // Make sure only the getOwnPropertyDescriptor trap is called, and not the has diff --git a/js/src/jit-test/tests/proxy/testDirectProxySet1.js b/js/src/jit-test/tests/proxy/testDirectProxySet1.js index c2a8c42f7f07..ddc1bc5ddc0a 100644 --- a/js/src/jit-test/tests/proxy/testDirectProxySet1.js +++ b/js/src/jit-test/tests/proxy/testDirectProxySet1.js @@ -10,11 +10,9 @@ for (let p of [new Proxy(target, {}), Proxy.revocable(target, {}).proxy]) { p['foo'] = 'buz'; assertEq(target.foo, 'buz'); - if (typeof Symbol === "function") { - var sym = Symbol.for('quux'); - p[sym] = sym; - assertEq(target[sym], sym); - // Reset for second iteration - target[sym] = undefined; - } + var sym = Symbol.for('quux'); + p[sym] = sym; + assertEq(target[sym], sym); + // Reset for second iteration + target[sym] = undefined; } diff --git a/js/src/jit-test/tests/proxy/testDirectProxySet2.js b/js/src/jit-test/tests/proxy/testDirectProxySet2.js index bec676c40b86..af940f6bc3fb 100644 --- a/js/src/jit-test/tests/proxy/testDirectProxySet2.js +++ b/js/src/jit-test/tests/proxy/testDirectProxySet2.js @@ -4,10 +4,7 @@ * third argument, and the receiver as the fourth argument */ var target = {}; -var keys = ['foo']; -if (typeof Symbol === "function") - keys.push(Symbol.for('quux')); -for (var key of keys) { +for (var key of ['foo', Symbol.for('quux')]) { var handler = { }; for (let p of [new Proxy(target, handler), Proxy.revocable(target, handler).proxy]) { handler.set = function (target1, name, val, receiver) { diff --git a/js/src/jit-test/tests/proxy/testDirectProxySet3.js b/js/src/jit-test/tests/proxy/testDirectProxySet3.js index 8e21bd46646c..94674aed61a0 100644 --- a/js/src/jit-test/tests/proxy/testDirectProxySet3.js +++ b/js/src/jit-test/tests/proxy/testDirectProxySet3.js @@ -1,10 +1,7 @@ load(libdir + "asserts.js"); // Throw a TypeError if the trap sets a non-writable, non-configurable property -var keys = ['foo']; -if (typeof Symbol === "function") - keys.push(Symbol.for('quux')); -for (var key of keys) { +for (var key of ['foo', Symbol.for('quux')]) { var target = {}; Object.defineProperty(target, key, { value: 'bar', diff --git a/js/src/jit-test/tests/self-test/assertDeepEq.js b/js/src/jit-test/tests/self-test/assertDeepEq.js index 106d5fcdf919..b2a949abc66e 100644 --- a/js/src/jit-test/tests/self-test/assertDeepEq.js +++ b/js/src/jit-test/tests/self-test/assertDeepEq.js @@ -14,24 +14,22 @@ assertNotDeepEq(undefined, null); assertNotDeepEq({}, null); // symbols -if (typeof Symbol === "function") { - assertDeepEq(Symbol(), Symbol()); - assertNotDeepEq(Symbol(), Symbol("")); - assertDeepEq(Symbol("tweedledum"), Symbol("tweedledum")); - assertNotDeepEq(Symbol("tweedledum"), Symbol("alice")); - assertNotDeepEq(Symbol("what-its-called"), Symbol.for("what-its-called")); - assertNotDeepEq(Symbol.iterator, Symbol.for("Symbol.iterator")); - assertDeepEq([Symbol(), Symbol(), Symbol()], - [Symbol(), Symbol(), Symbol()]); - var sym = Symbol(); - assertDeepEq([sym, sym], [sym, sym]); - assertNotDeepEq([sym, sym], [Symbol(), Symbol()]); - assertNotDeepEq([sym, sym], [Symbol(), sym]); - var obj1 = {}, obj2 = {}; - obj1[Symbol("x")] = "y"; - obj2[Symbol("x")] = "y"; - assertDeepEq(obj1, obj2); -} +assertDeepEq(Symbol(), Symbol()); +assertNotDeepEq(Symbol(), Symbol("")); +assertDeepEq(Symbol("tweedledum"), Symbol("tweedledum")); +assertNotDeepEq(Symbol("tweedledum"), Symbol("alice")); +assertNotDeepEq(Symbol("what-its-called"), Symbol.for("what-its-called")); +assertNotDeepEq(Symbol.iterator, Symbol.for("Symbol.iterator")); +assertDeepEq([Symbol(), Symbol(), Symbol()], + [Symbol(), Symbol(), Symbol()]); +var sym = Symbol(); +assertDeepEq([sym, sym], [sym, sym]); +assertNotDeepEq([sym, sym], [Symbol(), Symbol()]); +assertNotDeepEq([sym, sym], [Symbol(), sym]); +var obj1 = {}, obj2 = {}; +obj1[Symbol("x")] = "y"; +obj2[Symbol("x")] = "y"; +assertDeepEq(obj1, obj2); // objects assertDeepEq({}, {}); diff --git a/js/src/jit-test/tests/symbol/bug-1033856.js b/js/src/jit-test/tests/symbol/bug-1033856.js index 6d06da7aeaf1..18f80ac2024c 100644 --- a/js/src/jit-test/tests/symbol/bug-1033856.js +++ b/js/src/jit-test/tests/symbol/bug-1033856.js @@ -1,12 +1,6 @@ -function sym() { - return typeof Symbol === "function" ? Symbol() : "non-symbol"; -} - function f(x, y) { return x == y; } - f(1.1, 2.2); for (var i=0; i<5; i++) - f(1, sym()); - + f(1, Symbol()); diff --git a/js/src/jit-test/tests/symbol/not.js b/js/src/jit-test/tests/symbol/not.js index 727c566cb606..7237b0b36c55 100644 --- a/js/src/jit-test/tests/symbol/not.js +++ b/js/src/jit-test/tests/symbol/not.js @@ -1,9 +1,7 @@ -var sym = this.Symbol || (() => "truthy"); - for (var i = 0; i < 9; i++) - assertEq(!sym(), false, "symbols are truthy"); + assertEq(!Symbol(), false, "symbols are truthy"); -var a = [0, 0, 0, 0, 0, sym(), sym()]; +var a = [0, 0, 0, 0, 0, Symbol(), Symbol()]; var b = []; function f(i, v) { b[i] = !v; diff --git a/js/src/jit-test/tests/symbol/toNumber.js b/js/src/jit-test/tests/symbol/toNumber.js index 932c52baee2c..4677acbeb420 100644 --- a/js/src/jit-test/tests/symbol/toNumber.js +++ b/js/src/jit-test/tests/symbol/toNumber.js @@ -1,24 +1,36 @@ load(libdir + "asserts.js"); +var sym = Symbol(); + function add2(x) { return x + 2; } +for (var i = 0; i < 9; i++) + assertThrowsInstanceOf(() => add2(sym), TypeError); function sqr(x) { return x * x; } +for (var i = 0; i < 9; i++) + assertThrowsInstanceOf(() => sqr(sym), TypeError); function bit_or(x) { return x | x; } +for (var i = 0; i < 9; i++) + assertThrowsInstanceOf(() => bit_or(sym), TypeError); function bit_not(x) { return ~x; } +for (var i = 0; i < 9; i++) + assertThrowsInstanceOf(() => bit_not(sym), TypeError); function plus(x) { return +x; } +for (var i = 0; i < 9; i++) + assertThrowsInstanceOf(() => plus(sym), TypeError); function f(a, b) { return a + b; @@ -34,22 +46,8 @@ function testPoly() { assertThrowsInstanceOf(() => f(13.719, Symbol("14")), TypeError); } -if (typeof Symbol === "function") { - var sym = Symbol(); +for (var i = 0; i < 9; i++) + testPoly(); - for (var i = 0; i < 9; i++) - assertThrowsInstanceOf(() => add2(sym), TypeError); - for (var i = 0; i < 9; i++) - assertThrowsInstanceOf(() => sqr(sym), TypeError); - for (var i = 0; i < 9; i++) - assertThrowsInstanceOf(() => bit_or(sym), TypeError); - for (var i = 0; i < 9; i++) - assertThrowsInstanceOf(() => bit_not(sym), TypeError); - for (var i = 0; i < 9; i++) - assertThrowsInstanceOf(() => plus(sym), TypeError); - for (var i = 0; i < 9; i++) - testPoly(); - - for (var i = 0; i < 9; i++) - assertThrowsInstanceOf(() => assertEq(f(Symbol("14"), "40"), NaN), TypeError); -} +for (var i = 0; i < 9; i++) + assertThrowsInstanceOf(() => assertEq(f(Symbol("14"), "40"), NaN), TypeError); diff --git a/js/src/jit-test/tests/symbol/toString.js b/js/src/jit-test/tests/symbol/toString.js index 56b9f65b2be8..764ea7aab486 100644 --- a/js/src/jit-test/tests/symbol/toString.js +++ b/js/src/jit-test/tests/symbol/toString.js @@ -1,13 +1,11 @@ // ToString(symbol) throws a TypeError. -if (typeof Symbol === "function") { - var N = 10, obj, hits = 0; - for (var i = 0; i < N; i++) { - try { - obj = new String(Symbol()); - } catch (exc) { - hits++; - } +var N = 10, obj, hits = 0; +for (var i = 0; i < N; i++) { + try { + obj = new String(Symbol()); + } catch (exc) { + hits++; } - assertEq(hits, N); } +assertEq(hits, N); diff --git a/js/src/jit-test/tests/symbol/truthiness.js b/js/src/jit-test/tests/symbol/truthiness.js index ec3e0f5ef36d..a672158d6032 100644 --- a/js/src/jit-test/tests/symbol/truthiness.js +++ b/js/src/jit-test/tests/symbol/truthiness.js @@ -1,9 +1,7 @@ -var sym = this.Symbol || (() => "truthy"); - for (var i = 0; i < 9; i++) - assertEq(sym() ? 1 : 0, 1, "symbols are truthy"); + assertEq(Symbol() ? 1 : 0, 1, "symbols are truthy"); -var a = [0, 0, 0, 0, 0, sym(), sym()]; +var a = [0, 0, 0, 0, 0, Symbol(), Symbol()]; var b = []; function f(i, v) { b[i] = v ? "yes" : "no"; diff --git a/js/src/jit-test/tests/symbol/typed-arrays.js b/js/src/jit-test/tests/symbol/typed-arrays.js index 6e5e20d20fdb..005eec09afe0 100644 --- a/js/src/jit-test/tests/symbol/typed-arrays.js +++ b/js/src/jit-test/tests/symbol/typed-arrays.js @@ -2,30 +2,28 @@ load(libdir + "asserts.js"); var LENGTH = 1024, SYMBOL_INDEX = 999; -if (typeof Symbol === "function") { - var big = []; - for (var i = 0; i < LENGTH; i++) - big[i] = (i === SYMBOL_INDEX ? Symbol.for("comet") : i); +var big = []; +for (var i = 0; i < LENGTH; i++) + big[i] = (i === SYMBOL_INDEX ? Symbol.for("comet") : i); - var progress; - function copy(arr, big) { - for (var i = 0; i < LENGTH; i++) { - arr[i] = big[i]; - progress = i; - } - } - - for (var T of [Uint8Array, Uint8ClampedArray, Int16Array, Float32Array]) { - // Typed array constructors convert symbols using ToNumber, which throws. - assertThrowsInstanceOf(() => new T(big), TypeError); - - // Element assignment does the same. - var arr = new T(big.length); - for (var k = 0; k < 3; k++) { - progress = -1; - assertThrowsInstanceOf(() => copy(arr, big), TypeError); - assertEq(progress, SYMBOL_INDEX - 1); - assertEq(arr[SYMBOL_INDEX], 0); - } +var progress; +function copy(arr, big) { + for (var i = 0; i < LENGTH; i++) { + arr[i] = big[i]; + progress = i; + } +} + +for (var T of [Uint8Array, Uint8ClampedArray, Int16Array, Float32Array]) { + // Typed array constructors convert symbols using ToNumber, which throws. + assertThrowsInstanceOf(() => new T(big), TypeError); + + // Element assignment does the same. + var arr = new T(big.length); + for (var k = 0; k < 3; k++) { + progress = -1; + assertThrowsInstanceOf(() => copy(arr, big), TypeError); + assertEq(progress, SYMBOL_INDEX - 1); + assertEq(arr[SYMBOL_INDEX], 0); } } diff --git a/js/src/jit-test/tests/symbol/typeof.js b/js/src/jit-test/tests/symbol/typeof.js index d8862132330d..d2c7d51cfdd5 100644 --- a/js/src/jit-test/tests/symbol/typeof.js +++ b/js/src/jit-test/tests/symbol/typeof.js @@ -1,18 +1,9 @@ -function sym() { - return typeof Symbol === "function" ? Symbol() : "symbol"; -} - -function typ() { - return typeof Symbol === "function" ? "symbol" : "string"; -} - -var a = [0, 0, 0, 0, 0, sym(), sym()]; +var a = [0, 0, 0, 0, 0, Symbol(), Symbol()]; var b = []; function f(i, v) { b[i] = typeof v; } for (var i = 0; i < a.length; i++) f(i, a[i]); -assertEq(b[b.length - 2], typ()); -assertEq(b[b.length - 1], typ()); - +assertEq(b[b.length - 2], "symbol"); +assertEq(b[b.length - 1], "symbol"); diff --git a/js/src/tests/ecma_6/Class/compPropNames.js b/js/src/tests/ecma_6/Class/compPropNames.js index 803b02b9437c..a79f456846b2 100644 --- a/js/src/tests/ecma_6/Class/compPropNames.js +++ b/js/src/tests/ecma_6/Class/compPropNames.js @@ -95,12 +95,10 @@ a = {["x"]: 1, x: 2}; assertEq(a.x, 2); // Symbols -if (typeof Symbol === "function") { - var unique_sym = Symbol("1"), registered_sym = Symbol.for("2"); - a = { [unique_sym] : 2, [registered_sym] : 3 }; - assertEq(a[unique_sym], 2); - assertEq(a[registered_sym], 3); -} +var unique_sym = Symbol("1"), registered_sym = Symbol.for("2"); +a = { [unique_sym] : 2, [registered_sym] : 3 }; +assertEq(a[unique_sym], 2); +assertEq(a[registered_sym], 3); // Same expression can be run several times to build objects with different property names. a = []; @@ -215,13 +213,11 @@ assertEq(a.hey, 3); assertThrowsValue(() => { a.hey = 5; }, 2); // Symbols with duplicate get and set. -if (typeof Symbol === "function") { - expr = Symbol("hey"); - a = {get [expr]() { return 3; }, set[expr](v) { throw 2; }, - set [expr] (w) { throw 4; }, get[expr](){return 5; }}; - assertEq(a[expr], 5); - assertThrowsValue(() => { a[expr] = 7; }, 4); -} +expr = Symbol("hey"); +a = {get [expr]() { return 3; }, set[expr](v) { throw 2; }, + set [expr] (w) { throw 4; }, get[expr](){return 5; }}; +assertEq(a[expr], 5); +assertThrowsValue(() => { a[expr] = 7; }, 4); // expressions with side effects are called in the right order log = ""; diff --git a/js/src/tests/ecma_6/Class/methDefn.js b/js/src/tests/ecma_6/Class/methDefn.js index 302f366fcd96..b8d2275c2bef 100644 --- a/js/src/tests/ecma_6/Class/methDefn.js +++ b/js/src/tests/ecma_6/Class/methDefn.js @@ -102,12 +102,10 @@ assertEq(a.foo3(), 3); assertEq(a.foo4(), 4); // Symbols. -if (typeof Symbol === "function") { - var unique_sym = Symbol("1"), registered_sym = Symbol.for("2"); - a = { [unique_sym](){return 2;}, [registered_sym](){return 3;} }; - assertEq(a[unique_sym](), 2); - assertEq(a[registered_sym](), 3); -} +var unique_sym = Symbol("1"), registered_sym = Symbol.for("2"); +a = { [unique_sym](){return 2;}, [registered_sym](){return 3;} }; +assertEq(a[unique_sym](), 2); +assertEq(a[registered_sym](), 3); // Method characteristics. a = { b(){ return 4;} }; diff --git a/js/src/tests/ecma_6/Map/symbols.js b/js/src/tests/ecma_6/Map/symbols.js index f6fe795de429..30589a97323b 100644 --- a/js/src/tests/ecma_6/Map/symbols.js +++ b/js/src/tests/ecma_6/Map/symbols.js @@ -1,35 +1,33 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - var m = new Map; +var m = new Map; - // Symbols can be Map keys. - var sym = Symbol(); - m.set(sym, "zero"); - assertEq(m.has(sym), true); - assertEq(m.get(sym), "zero"); - assertEq(m.has(Symbol()), false); - assertEq(m.get(Symbol()), undefined); - assertEq([...m][0][0], sym); - m.set(sym, "replaced"); - assertEq(m.get(sym), "replaced"); - m.delete(sym); - assertEq(m.has(sym), false); - assertEq(m.size, 0); +// Symbols can be Map keys. +var sym = Symbol(); +m.set(sym, "zero"); +assertEq(m.has(sym), true); +assertEq(m.get(sym), "zero"); +assertEq(m.has(Symbol()), false); +assertEq(m.get(Symbol()), undefined); +assertEq([...m][0][0], sym); +m.set(sym, "replaced"); +assertEq(m.get(sym), "replaced"); +m.delete(sym); +assertEq(m.has(sym), false); +assertEq(m.size, 0); - // Symbols returned by Symbol.for() can be Map keys. - for (var word of "that that is is that that is not is not is that not it".split(' ')) { - sym = Symbol.for(word); - m.set(sym, (m.get(sym) || 0) + 1); - } - assertDeepEq([...m], [ - [Symbol.for("that"), 5], - [Symbol.for("is"), 5], - [Symbol.for("not"), 3], - [Symbol.for("it"), 1] - ]); +// Symbols returned by Symbol.for() can be Map keys. +for (var word of "that that is is that that is not is not is that not it".split(' ')) { + sym = Symbol.for(word); + m.set(sym, (m.get(sym) || 0) + 1); } +assertDeepEq([...m], [ + [Symbol.for("that"), 5], + [Symbol.for("is"), 5], + [Symbol.for("not"), 3], + [Symbol.for("it"), 1] +]); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Object/assign.js b/js/src/tests/ecma_6/Object/assign.js index 6c720804bf8b..b39a48591fef 100644 --- a/js/src/tests/ecma_6/Object/assign.js +++ b/js/src/tests/ecma_6/Object/assign.js @@ -36,8 +36,7 @@ function basicSymbols() { assertEq(a.bProp, 7); assertEq(a[aSymbol], 22); } -if (typeof Symbol === "function") - basicSymbols(); +basicSymbols(); // Calls ToObject() for target, skips null/undefined sources, uses // ToObject(source) otherwise. diff --git a/js/src/tests/ecma_6/Object/getOwnPropertySymbols-proxy.js b/js/src/tests/ecma_6/Object/getOwnPropertySymbols-proxy.js index 7a0540e0c1c1..56f20afb3a1b 100644 --- a/js/src/tests/ecma_6/Object/getOwnPropertySymbols-proxy.js +++ b/js/src/tests/ecma_6/Object/getOwnPropertySymbols-proxy.js @@ -1,6 +1,11 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ +// getOwnPropertySymbols(proxy) calls the getOwnPropertyNames hook (only). + +var symbols = [Symbol(), Symbol("moon"), Symbol.for("sun"), Symbol.iterator]; +var hits = 0; + function HandlerProxy() { return new Proxy({}, { get: function (t, key) { @@ -16,15 +21,8 @@ function OwnKeysProxy() { return new Proxy({}, new HandlerProxy); } -if (typeof Symbol === "function") { - // getOwnPropertySymbols(proxy) calls the getOwnPropertyNames hook (only). - - var symbols = [Symbol(), Symbol("moon"), Symbol.for("sun"), Symbol.iterator]; - var hits = 0; - - assertDeepEq(Object.getOwnPropertySymbols(new OwnKeysProxy), symbols); - assertEq(hits, 1); -} +assertDeepEq(Object.getOwnPropertySymbols(new OwnKeysProxy), symbols); +assertEq(hits, 1); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Object/getOwnPropertySymbols.js b/js/src/tests/ecma_6/Object/getOwnPropertySymbols.js index ea500707df67..b92d14ef1762 100644 --- a/js/src/tests/ecma_6/Object/getOwnPropertySymbols.js +++ b/js/src/tests/ecma_6/Object/getOwnPropertySymbols.js @@ -1,48 +1,46 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - assertDeepEq(Object.getOwnPropertySymbols({}), []); +assertDeepEq(Object.getOwnPropertySymbols({}), []); - // String keys are ignored. - assertEq(Object.getOwnPropertySymbols({a: 1, b: 2}).length, 0); - assertEq(Object.getOwnPropertySymbols([0, 1, 2, 3]).length, 0); +// String keys are ignored. +assertEq(Object.getOwnPropertySymbols({a: 1, b: 2}).length, 0); +assertEq(Object.getOwnPropertySymbols([0, 1, 2, 3]).length, 0); - // Symbol keys are observed. - var iterable = {}; - Object.defineProperty(iterable, Symbol.iterator, { - value: () => [][Symbol.iterator]() - }); - assertDeepEq(Object.getOwnPropertySymbols(iterable), [Symbol.iterator]); - assertDeepEq(Object.getOwnPropertySymbols(new Proxy(iterable, {})), [Symbol.iterator]); +// Symbol keys are observed. +var iterable = {}; +Object.defineProperty(iterable, Symbol.iterator, { + value: () => [][Symbol.iterator]() +}); +assertDeepEq(Object.getOwnPropertySymbols(iterable), [Symbol.iterator]); +assertDeepEq(Object.getOwnPropertySymbols(new Proxy(iterable, {})), [Symbol.iterator]); - // Test on an object with a thousand own properties. - var obj = {}; - for (var i = 0; i < 1000; i++) { - obj[Symbol.for("x" + i)] = 1; - } - assertEq(Object.getOwnPropertyNames(obj).length, 0); - var symbols = Object.getOwnPropertySymbols(obj); - assertEq(symbols.length, 1000); - assertEq(symbols.indexOf(Symbol.for("x0")) !== -1, true); - assertEq(symbols.indexOf(Symbol.for("x241")) !== -1, true); - assertEq(symbols.indexOf(Symbol.for("x999")) !== -1, true); - assertEq(Object.getOwnPropertySymbols(new Proxy(obj, {})).length, 1000); - - // The prototype chain is not consulted. - assertEq(Object.getOwnPropertySymbols(Object.create(obj)).length, 0); - assertEq(Object.getOwnPropertySymbols(new Proxy(Object.create(obj), {})).length, 0); - - // Primitives are coerced to objects; but there are never any symbol-keyed - // properties on the resulting wrapper objects. - assertThrowsInstanceOf(() => Object.getOwnPropertySymbols(), TypeError); - assertThrowsInstanceOf(() => Object.getOwnPropertySymbols(undefined), TypeError); - assertThrowsInstanceOf(() => Object.getOwnPropertySymbols(null), TypeError); - for (var primitive of [true, 1, 3.14, "hello", Symbol()]) - assertEq(Object.getOwnPropertySymbols(primitive).length, 0); - - assertEq(Object.getOwnPropertySymbols.length, 1); +// Test on an object with a thousand own properties. +var obj = {}; +for (var i = 0; i < 1000; i++) { + obj[Symbol.for("x" + i)] = 1; } +assertEq(Object.getOwnPropertyNames(obj).length, 0); +var symbols = Object.getOwnPropertySymbols(obj); +assertEq(symbols.length, 1000); +assertEq(symbols.indexOf(Symbol.for("x0")) !== -1, true); +assertEq(symbols.indexOf(Symbol.for("x241")) !== -1, true); +assertEq(symbols.indexOf(Symbol.for("x999")) !== -1, true); +assertEq(Object.getOwnPropertySymbols(new Proxy(obj, {})).length, 1000); + +// The prototype chain is not consulted. +assertEq(Object.getOwnPropertySymbols(Object.create(obj)).length, 0); +assertEq(Object.getOwnPropertySymbols(new Proxy(Object.create(obj), {})).length, 0); + +// Primitives are coerced to objects; but there are never any symbol-keyed +// properties on the resulting wrapper objects. +assertThrowsInstanceOf(() => Object.getOwnPropertySymbols(), TypeError); +assertThrowsInstanceOf(() => Object.getOwnPropertySymbols(undefined), TypeError); +assertThrowsInstanceOf(() => Object.getOwnPropertySymbols(null), TypeError); +for (var primitive of [true, 1, 3.14, "hello", Symbol()]) + assertEq(Object.getOwnPropertySymbols(primitive).length, 0); + +assertEq(Object.getOwnPropertySymbols.length, 1); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Set/symbols.js b/js/src/tests/ecma_6/Set/symbols.js index bad0031ca292..364b3155c24a 100644 --- a/js/src/tests/ecma_6/Set/symbols.js +++ b/js/src/tests/ecma_6/Set/symbols.js @@ -1,29 +1,27 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - var s = new Set; +var s = new Set; - // Symbols can be stored in Sets. - var sym = Symbol(); - s.add(sym); - assertEq(s.has(sym), true); - assertEq(s.has(Symbol()), false); - assertEq([...s][0], sym); - s.add(sym); - assertEq(s.has(sym), true); - assertEq(s.size, 1); - s.delete(sym); - assertEq(s.has(sym), false); - assertEq(s.size, 0); +// Symbols can be stored in Sets. +var sym = Symbol(); +s.add(sym); +assertEq(s.has(sym), true); +assertEq(s.has(Symbol()), false); +assertEq([...s][0], sym); +s.add(sym); +assertEq(s.has(sym), true); +assertEq(s.size, 1); +s.delete(sym); +assertEq(s.has(sym), false); +assertEq(s.size, 0); - // Symbols returned by Symbol.for() can be in Sets. - var str = "how much wood would a woodchuck chuck if a woodchuck could chuck wood"; - var s2 = "how much wood would a woodchuck chuck if could"; - var arr = [for (word of str.split(" ")) Symbol.for(word)]; - s = new Set(arr); - assertDeepEq([...s], [for (word of s2.split(" ")) Symbol.for(word)]); -} +// Symbols returned by Symbol.for() can be in Sets. +var str = "how much wood would a woodchuck chuck if a woodchuck could chuck wood"; +var s2 = "how much wood would a woodchuck chuck if could"; +var arr = [for (word of str.split(" ")) Symbol.for(word)]; +s = new Set(arr); +assertDeepEq([...s], [for (word of s2.split(" ")) Symbol.for(word)]); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/as-base-value.js b/js/src/tests/ecma_6/Symbol/as-base-value.js index f3ccb880f52f..c8880f653b0c 100644 --- a/js/src/tests/ecma_6/Symbol/as-base-value.js +++ b/js/src/tests/ecma_6/Symbol/as-base-value.js @@ -1,90 +1,88 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - // Like other primitives, symbols can be treated as objects, using object-like - // syntax: `symbol.prop` or `symbol[key]`. - // - // In ECMAScript spec jargon, this creates a Reference whose base value is a - // primitive Symbol value. +// Like other primitives, symbols can be treated as objects, using object-like +// syntax: `symbol.prop` or `symbol[key]`. +// +// In ECMAScript spec jargon, this creates a Reference whose base value is a +// primitive Symbol value. - var symbols = [ - Symbol(), - Symbol("ponies"), - Symbol.for("sym"), - Symbol.iterator - ]; +var symbols = [ + Symbol(), + Symbol("ponies"), + Symbol.for("sym"), + Symbol.iterator +]; - // Test accessor property, used below. - var gets, sets; - Object.defineProperty(Symbol.prototype, "prop", { - get: function () { - "use strict"; - gets++; - assertEq(typeof this, "object"); - assertEq(this instanceof Symbol, true); - assertEq(this.valueOf(), sym); - return "got"; - }, - set: function (v) { - "use strict"; - sets++; - assertEq(typeof this, "object"); - assertEq(this instanceof Symbol, true); - assertEq(this.valueOf(), sym); - assertEq(v, "newvalue"); - } - }); - - for (var sym of symbols) { - assertEq(sym.constructor, Symbol); - - // method on Object.prototype - assertEq(sym.hasOwnProperty("constructor"), false); - assertEq(sym.toLocaleString(), sym.toString()); // once .toString() exists - - // custom method monkeypatched onto Symbol.prototype - Symbol.prototype.nonStrictMethod = function (arg) { - assertEq(arg, "ok"); - assertEq(this instanceof Symbol, true); - assertEq(this.valueOf(), sym); - return 13; - }; - assertEq(sym.nonStrictMethod("ok"), 13); - - // the same, but strict mode - Symbol.prototype.strictMethod = function (arg) { - "use strict"; - assertEq(arg, "ok2"); - assertEq(this, sym); - return 14; - }; - assertEq(sym.strictMethod("ok2"), 14); - - // getter/setter on Symbol.prototype - gets = 0; - sets = 0; - var propname = "prop"; - - assertEq(sym.prop, "got"); - assertEq(gets, 1); - assertEq(sym[propname], "got"); - assertEq(gets, 2); - - assertEq(sym.prop = "newvalue", "newvalue"); - assertEq(sets, 1); - assertEq(sym[propname] = "newvalue", "newvalue"); - assertEq(sets, 2); - - // non-existent property - assertEq(sym.noSuchProp, undefined); - var noSuchPropName = "nonesuch"; - assertEq(sym[noSuchPropName], undefined); - - // non-existent method - assertThrowsInstanceOf(() => sym.noSuchProp(), TypeError); - assertThrowsInstanceOf(() => sym[noSuchPropName](), TypeError); +// Test accessor property, used below. +var gets, sets; +Object.defineProperty(Symbol.prototype, "prop", { + get: function () { + "use strict"; + gets++; + assertEq(typeof this, "object"); + assertEq(this instanceof Symbol, true); + assertEq(this.valueOf(), sym); + return "got"; + }, + set: function (v) { + "use strict"; + sets++; + assertEq(typeof this, "object"); + assertEq(this instanceof Symbol, true); + assertEq(this.valueOf(), sym); + assertEq(v, "newvalue"); } +}); + +for (var sym of symbols) { + assertEq(sym.constructor, Symbol); + + // method on Object.prototype + assertEq(sym.hasOwnProperty("constructor"), false); + assertEq(sym.toLocaleString(), sym.toString()); // once .toString() exists + + // custom method monkeypatched onto Symbol.prototype + Symbol.prototype.nonStrictMethod = function (arg) { + assertEq(arg, "ok"); + assertEq(this instanceof Symbol, true); + assertEq(this.valueOf(), sym); + return 13; + }; + assertEq(sym.nonStrictMethod("ok"), 13); + + // the same, but strict mode + Symbol.prototype.strictMethod = function (arg) { + "use strict"; + assertEq(arg, "ok2"); + assertEq(this, sym); + return 14; + }; + assertEq(sym.strictMethod("ok2"), 14); + + // getter/setter on Symbol.prototype + gets = 0; + sets = 0; + var propname = "prop"; + + assertEq(sym.prop, "got"); + assertEq(gets, 1); + assertEq(sym[propname], "got"); + assertEq(gets, 2); + + assertEq(sym.prop = "newvalue", "newvalue"); + assertEq(sets, 1); + assertEq(sym[propname] = "newvalue", "newvalue"); + assertEq(sets, 2); + + // non-existent property + assertEq(sym.noSuchProp, undefined); + var noSuchPropName = "nonesuch"; + assertEq(sym[noSuchPropName], undefined); + + // non-existent method + assertThrowsInstanceOf(() => sym.noSuchProp(), TypeError); + assertThrowsInstanceOf(() => sym[noSuchPropName](), TypeError); } if (typeof reportCompare === "function") diff --git a/js/src/tests/ecma_6/Symbol/comparisons.js b/js/src/tests/ecma_6/Symbol/comparisons.js index 311245aa7c83..d2105c8a1aa6 100644 --- a/js/src/tests/ecma_6/Symbol/comparisons.js +++ b/js/src/tests/ecma_6/Symbol/comparisons.js @@ -1,34 +1,32 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - var symbols = [ - Symbol(), - Symbol("0"), - Symbol.for("snowman"), - Symbol.iterator - ]; +var symbols = [ + Symbol(), + Symbol("0"), + Symbol.for("snowman"), + Symbol.iterator +]; - var values = [ - undefined, null, 0, 3.14, -0, NaN, "", "alphabet", Symbol("0"), - {}, [] - ]; +var values = [ + undefined, null, 0, 3.14, -0, NaN, "", "alphabet", Symbol("0"), + {}, [] +]; - for (var comparator of ["==", "!=", "===", "!=="]) { - var f = Function("a, b", "return a " + comparator + " b;"); - var expected = (comparator[0] == '!'); - for (var a of symbols) { - for (var b of values) - assertEq(f(a, b), expected); - } +for (var comparator of ["==", "!=", "===", "!=="]) { + var f = Function("a, b", "return a " + comparator + " b;"); + var expected = (comparator[0] == '!'); + for (var a of symbols) { + for (var b of values) + assertEq(f(a, b), expected); } +} - for (var comparator of ["<", "<=", ">", ">="]) { - var f = Function("a, b", "return a " + comparator + " b;"); - for (var a of symbols) { - for (var b of values) - assertThrowsInstanceOf(() => f(a, b), TypeError); - } +for (var comparator of ["<", "<=", ">", ">="]) { + var f = Function("a, b", "return a " + comparator + " b;"); + for (var a of symbols) { + for (var b of values) + assertThrowsInstanceOf(() => f(a, b), TypeError); } } diff --git a/js/src/tests/ecma_6/Symbol/constructor.js b/js/src/tests/ecma_6/Symbol/constructor.js index 784c386918d9..5143b02a9e4b 100644 --- a/js/src/tests/ecma_6/Symbol/constructor.js +++ b/js/src/tests/ecma_6/Symbol/constructor.js @@ -1,37 +1,35 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - // Symbol(symbol) throws a TypeError. - var sym = Symbol(); - assertThrowsInstanceOf(() => Symbol(sym), TypeError); +// Symbol(symbol) throws a TypeError. +var sym = Symbol(); +assertThrowsInstanceOf(() => Symbol(sym), TypeError); - // Symbol(undefined) is equivalent to Symbol(). - assertEq(Symbol(undefined).toString(), "Symbol()"); +// Symbol(undefined) is equivalent to Symbol(). +assertEq(Symbol(undefined).toString(), "Symbol()"); - // Otherwise, Symbol(v) means Symbol(ToString(v)). - assertEq(Symbol(7).toString(), "Symbol(7)"); - assertEq(Symbol(true).toString(), "Symbol(true)"); - assertEq(Symbol(null).toString(), "Symbol(null)"); - assertEq(Symbol([1, 2]).toString(), "Symbol(1,2)"); - var symobj = Object(sym); - assertThrowsInstanceOf(() => Symbol(symobj), TypeError); +// Otherwise, Symbol(v) means Symbol(ToString(v)). +assertEq(Symbol(7).toString(), "Symbol(7)"); +assertEq(Symbol(true).toString(), "Symbol(true)"); +assertEq(Symbol(null).toString(), "Symbol(null)"); +assertEq(Symbol([1, 2]).toString(), "Symbol(1,2)"); +var symobj = Object(sym); +assertThrowsInstanceOf(() => Symbol(symobj), TypeError); - var hits = 0; - var obj = { - toString: function () { - hits++; - return "ponies"; - } - }; - assertEq(Symbol(obj).toString(), "Symbol(ponies)"); - assertEq(hits, 1); +var hits = 0; +var obj = { + toString: function () { + hits++; + return "ponies"; + } +}; +assertEq(Symbol(obj).toString(), "Symbol(ponies)"); +assertEq(hits, 1); - assertEq(Object.getPrototypeOf(Symbol.prototype), Object.prototype); +assertEq(Object.getPrototypeOf(Symbol.prototype), Object.prototype); - // Symbol.prototype is not itself a Symbol object. - assertThrowsInstanceOf(() => Symbol.prototype.valueOf(), TypeError); -} +// Symbol.prototype is not itself a Symbol object. +assertThrowsInstanceOf(() => Symbol.prototype.valueOf(), TypeError); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/conversions.js b/js/src/tests/ecma_6/Symbol/conversions.js index ec0e00fdb2ef..47e1cc4bb2c1 100644 --- a/js/src/tests/ecma_6/Symbol/conversions.js +++ b/js/src/tests/ecma_6/Symbol/conversions.js @@ -1,67 +1,65 @@ // Section numbers cite ES6 rev 24 (2014 April 27). -if (typeof Symbol === "function") { - var symbols = [ - Symbol(), - Symbol("one"), - Symbol.for("two"), - Symbol.iterator - ]; +var symbols = [ + Symbol(), + Symbol("one"), + Symbol.for("two"), + Symbol.iterator +]; - if (Symbol.toPrimitive in Symbol.prototype) { - // We should test that deleting Symbol.prototype[@@toPrimitive] changes the - // behavior of ToPrimitive on Symbol objects, but @@toPrimitive is not - // implemented yet. - throw new Error("Congratulations on implementing @@toPrimitive! Please update this test."); - } +if (Symbol.toPrimitive in Symbol.prototype) { + // We should test that deleting Symbol.prototype[@@toPrimitive] changes the + // behavior of ToPrimitive on Symbol objects, but @@toPrimitive is not + // implemented yet. + throw new Error("Congratulations on implementing @@toPrimitive! Please update this test."); +} - for (var sym of symbols) { - // 7.1.1 ToPrimitive - var symobj = Object(sym); - assertThrowsInstanceOf(() => Number(symobj), TypeError); - assertThrowsInstanceOf(() => String(symobj), TypeError); - assertThrowsInstanceOf(() => symobj < 0, TypeError); - assertThrowsInstanceOf(() => 0 < symobj, TypeError); - assertThrowsInstanceOf(() => symobj + 1, TypeError); - assertThrowsInstanceOf(() => "" + symobj, TypeError); - assertEq(sym == symobj, true); - assertEq(sym === symobj, false); - assertEq(symobj == 0, false); - assertEq(0 != symobj, true); +for (var sym of symbols) { + // 7.1.1 ToPrimitive + var symobj = Object(sym); + assertThrowsInstanceOf(() => Number(symobj), TypeError); + assertThrowsInstanceOf(() => String(symobj), TypeError); + assertThrowsInstanceOf(() => symobj < 0, TypeError); + assertThrowsInstanceOf(() => 0 < symobj, TypeError); + assertThrowsInstanceOf(() => symobj + 1, TypeError); + assertThrowsInstanceOf(() => "" + symobj, TypeError); + assertEq(sym == symobj, true); + assertEq(sym === symobj, false); + assertEq(symobj == 0, false); + assertEq(0 != symobj, true); - // 7.1.2 ToBoolean - assertEq(Boolean(sym), true); - assertEq(!sym, false); - assertEq(sym || 13, sym); - assertEq(sym && 13, 13); + // 7.1.2 ToBoolean + assertEq(Boolean(sym), true); + assertEq(!sym, false); + assertEq(sym || 13, sym); + assertEq(sym && 13, 13); - // 7.1.3 ToNumber - assertThrowsInstanceOf(() => +sym, TypeError); - assertThrowsInstanceOf(() => sym | 0, TypeError); + // 7.1.3 ToNumber + assertThrowsInstanceOf(() => +sym, TypeError); + assertThrowsInstanceOf(() => sym | 0, TypeError); - // 7.1.12 ToString - assertThrowsInstanceOf(() => "" + sym, TypeError); - assertThrowsInstanceOf(() => sym + "", TypeError); - assertThrowsInstanceOf(() => "" + [1, 2, Symbol()], TypeError); - assertThrowsInstanceOf(() => ["simple", "thimble", Symbol()].join(), TypeError); + // 7.1.12 ToString + assertThrowsInstanceOf(() => "" + sym, TypeError); + assertThrowsInstanceOf(() => sym + "", TypeError); + assertThrowsInstanceOf(() => "" + [1, 2, Symbol()], TypeError); + assertThrowsInstanceOf(() => ["simple", "thimble", Symbol()].join(), TypeError); - // 21.1.1.1 String() - assertEq(String(sym), sym.toString()); - assertThrowsInstanceOf(() => String(Object(sym)), TypeError); + // 21.1.1.1 String() + assertEq(String(sym), sym.toString()); + assertThrowsInstanceOf(() => String(Object(sym)), TypeError); - // 21.1.1.2 new String() - assertThrowsInstanceOf(() => new String(sym), TypeError); + // 21.1.1.2 new String() + assertThrowsInstanceOf(() => new String(sym), TypeError); - // 7.1.13 ToObject - var obj = Object(sym); - assertEq(typeof obj, "object"); - assertEq(Object.prototype.toString.call(obj), "[object Symbol]"); - assertEq(Object.getPrototypeOf(obj), Symbol.prototype); - assertEq(Object.getOwnPropertyNames(obj).length, 0); - assertEq(Object(sym) === Object(sym), false); // new object each time - var f = function () { return this; }; - assertEq(f.call(sym) === f.call(sym), false); // new object each time - } + // 7.1.13 ToObject + var obj = Object(sym); + assertEq(typeof obj, "object"); + assertEq(Object.prototype.toString.call(obj), "[object Symbol]"); + assertEq(Object.getPrototypeOf(obj), Symbol.prototype); + assertEq(Object.getOwnPropertyNames(obj).length, 0); + assertEq(Object(sym) === Object(sym), false); // new object each time + var f = function () { return this; }; + assertEq(f.call(sym) === f.call(sym), false); // new object each time } if (typeof reportCompare === "function") diff --git a/js/src/tests/ecma_6/Symbol/enumeration-order.js b/js/src/tests/ecma_6/Symbol/enumeration-order.js index 5b2d1e586ca2..8bcd1f02ff41 100644 --- a/js/src/tests/ecma_6/Symbol/enumeration-order.js +++ b/js/src/tests/ecma_6/Symbol/enumeration-order.js @@ -1,6 +1,7 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ +// Symbols follow all other property keys in the result list. var log; function LoggingProxy() { return new Proxy({}, { @@ -11,6 +12,18 @@ function LoggingProxy() { }); } +var keys = [ + "before", + Symbol(), + "during", + Symbol.for("during"), + Symbol.iterator, + "after" +]; +var descs = {}; +for (var k of keys) + descs[k] = {configurable: true, value: 0}; + function test(descsObj) { log = []; Object.defineProperties(LoggingProxy(), descs); @@ -20,24 +33,8 @@ function test(descsObj) { assertEq(log.indexOf(key) !== -1, true); } -if (typeof Symbol === "function") { - // ES6 draft rev 25 (2014 May 22), 9.1.12 "[[OwnPropertyKeys]] ()": - - var keys = [ - "before", - Symbol(), - "during", - Symbol.for("during"), - Symbol.iterator, - "after" - ]; - var descs = {}; - for (var k of keys) - descs[k] = {configurable: true, value: 0}; - - test(descs); - test(new Proxy(descs, {})); -} +test(descs); +test(new Proxy(descs, {})); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/enumeration.js b/js/src/tests/ecma_6/Symbol/enumeration.js index 6401483a5588..e7ca426e6d39 100644 --- a/js/src/tests/ecma_6/Symbol/enumeration.js +++ b/js/src/tests/ecma_6/Symbol/enumeration.js @@ -1,54 +1,52 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - // for-in loops skip properties with symbol keys, even enumerable properties. - var obj = {}; - obj[Symbol.for("moon")] = "sun"; - obj[Symbol("asleep")] = "awake"; - obj[Symbol.iterator] = "List"; - for (var x in obj) - throw "FAIL: " + uneval(x); +// for-in loops skip properties with symbol keys, even enumerable properties. +var obj = {}; +obj[Symbol.for("moon")] = "sun"; +obj[Symbol("asleep")] = "awake"; +obj[Symbol.iterator] = "List"; +for (var x in obj) + throw "FAIL: " + uneval(x); - // This includes inherited properties. - var obj2 = Object.create(obj); - for (var x in obj2) - throw "FAIL: " + uneval(x); +// This includes inherited properties. +var obj2 = Object.create(obj); +for (var x in obj2) + throw "FAIL: " + uneval(x); - // The same goes for proxies. - var p = new Proxy(obj, {}); - for (var x in p) - throw "FAIL: " + uneval(x); - var p2 = new Proxy(obj2, {}); - for (var x in p2) - throw "FAIL: " + uneval(x); +// The same goes for proxies. +var p = new Proxy(obj, {}); +for (var x in p) + throw "FAIL: " + uneval(x); +var p2 = new Proxy(obj2, {}); +for (var x in p2) + throw "FAIL: " + uneval(x); - // Object.keys() and .getOwnPropertyNames() also skip symbols. - assertEq(Object.keys(obj).length, 0); - assertEq(Object.keys(p).length, 0); - assertEq(Object.keys(obj2).length, 0); - assertEq(Object.keys(p2).length, 0); - assertEq(Object.getOwnPropertyNames(obj).length, 0); - assertEq(Object.getOwnPropertyNames(p).length, 0); - assertEq(Object.getOwnPropertyNames(obj2).length, 0); - assertEq(Object.getOwnPropertyNames(p2).length, 0); +// Object.keys() and .getOwnPropertyNames() also skip symbols. +assertEq(Object.keys(obj).length, 0); +assertEq(Object.keys(p).length, 0); +assertEq(Object.keys(obj2).length, 0); +assertEq(Object.keys(p2).length, 0); +assertEq(Object.getOwnPropertyNames(obj).length, 0); +assertEq(Object.getOwnPropertyNames(p).length, 0); +assertEq(Object.getOwnPropertyNames(obj2).length, 0); +assertEq(Object.getOwnPropertyNames(p2).length, 0); - // Test interaction of Object.keys(), proxies, and symbol property keys. - var log = []; - var h = { - ownKeys: (t) => { - log.push("ownKeys"); - return ["a", "0", Symbol.for("moon"), Symbol("asleep"), Symbol.iterator]; - }, - getOwnPropertyDescriptor: (t, key) => { - log.push("gopd", key); - return {configurable: true, enumerable: true, value: 0, writable: true}; - } - }; - p = new Proxy({}, h); - assertDeepEq(Object.keys(p), ["a", "0"]); - assertDeepEq(log, ["ownKeys", "gopd", "a", "gopd", "0"]); -} +// Test interaction of Object.keys(), proxies, and symbol property keys. +var log = []; +var h = { + ownKeys: (t) => { + log.push("ownKeys"); + return ["a", "0", Symbol.for("moon"), Symbol("asleep"), Symbol.iterator]; + }, + getOwnPropertyDescriptor: (t, key) => { + log.push("gopd", key); + return {configurable: true, enumerable: true, value: 0, writable: true}; + } +}; +p = new Proxy({}, h); +assertDeepEq(Object.keys(p), ["a", "0"]); +assertDeepEq(log, ["ownKeys", "gopd", "a", "gopd", "0"]); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/equality.js b/js/src/tests/ecma_6/Symbol/equality.js index 66eaa7902adb..eaa091ba43f2 100644 --- a/js/src/tests/ecma_6/Symbol/equality.js +++ b/js/src/tests/ecma_6/Symbol/equality.js @@ -1,30 +1,28 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - // Symbol.for returns the same symbol whenever the same argument is passed. - assertEq(Symbol.for("q") === Symbol.for("q"), true); +// Symbol.for returns the same symbol whenever the same argument is passed. +assertEq(Symbol.for("q") === Symbol.for("q"), true); - // Several distinct Symbol values. - var symbols = [ - Symbol(), - Symbol("Symbol.iterator"), - Symbol("Symbol.iterator"), // distinct new symbol with the same description - Symbol.for("Symbol.iterator"), - Symbol.iterator - ]; +// Several distinct Symbol values. +var symbols = [ + Symbol(), + Symbol("Symbol.iterator"), + Symbol("Symbol.iterator"), // distinct new symbol with the same description + Symbol.for("Symbol.iterator"), + Symbol.iterator +]; - // Distinct symbols are never equal to each other, even if they have the same - // description. - for (var i = 0; i < symbols.length; i++) { - for (var j = i; j < symbols.length; j++) { - var expected = (i === j); - assertEq(symbols[i] == symbols[j], expected); - assertEq(symbols[i] != symbols[j], !expected); - assertEq(symbols[i] === symbols[j], expected); - assertEq(symbols[i] !== symbols[j], !expected); - assertEq(Object.is(symbols[i], symbols[j]), expected); - } +// Distinct symbols are never equal to each other, even if they have the same +// description. +for (var i = 0; i < symbols.length; i++) { + for (var j = i; j < symbols.length; j++) { + var expected = (i === j); + assertEq(symbols[i] == symbols[j], expected); + assertEq(symbols[i] != symbols[j], !expected); + assertEq(symbols[i] === symbols[j], expected); + assertEq(symbols[i] !== symbols[j], !expected); + assertEq(Object.is(symbols[i], symbols[j]), expected); } } diff --git a/js/src/tests/ecma_6/Symbol/errors.js b/js/src/tests/ecma_6/Symbol/errors.js index 64e535675923..d6eb37abc495 100644 --- a/js/src/tests/ecma_6/Symbol/errors.js +++ b/js/src/tests/ecma_6/Symbol/errors.js @@ -1,19 +1,17 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - // Section numbers cite ES6 rev 24 (2014 April 27). +// Section numbers cite ES6 rev 24 (2014 April 27). - var sym = Symbol(); +var sym = Symbol(); - // 7.2.2 IsCallable - assertThrowsInstanceOf(() => sym(), TypeError); - assertThrowsInstanceOf(() => Function.prototype.call.call(sym), TypeError); +// 7.2.2 IsCallable +assertThrowsInstanceOf(() => sym(), TypeError); +assertThrowsInstanceOf(() => Function.prototype.call.call(sym), TypeError); - // 7.2.5 IsConstructor - assertThrowsInstanceOf(() => new sym(), TypeError); - assertThrowsInstanceOf(() => new Symbol(), TypeError); -} +// 7.2.5 IsConstructor +assertThrowsInstanceOf(() => new sym(), TypeError); +assertThrowsInstanceOf(() => new Symbol(), TypeError); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/for-in-order.js b/js/src/tests/ecma_6/Symbol/for-in-order.js index c3969b9d6003..7d1f23430535 100644 --- a/js/src/tests/ecma_6/Symbol/for-in-order.js +++ b/js/src/tests/ecma_6/Symbol/for-in-order.js @@ -1,35 +1,33 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - // ES6 does not specify enumeration order, but implementations mostly retain - // property insertion order -- and must, for web compatibility. This test checks - // that symbol-keyed properties do not interfere with that order. +// ES6 does not specify enumeration order, but implementations mostly retain +// property insertion order -- and must, for web compatibility. This test checks +// that symbol-keyed properties do not interfere with that order. - var obj = {}; - obj[Symbol("moon")] = 0; - obj.x = 1; - obj[Symbol.for("y")] = 2 - obj.y = 3; - obj[Symbol.iterator] = function* () { yield 4; }; - obj.z = 5; - Object.prototype[Symbol.for("comet")] = 6; +var obj = {}; +obj[Symbol("moon")] = 0; +obj.x = 1; +obj[Symbol.for("y")] = 2 +obj.y = 3; +obj[Symbol.iterator] = function* () { yield 4; }; +obj.z = 5; +Object.prototype[Symbol.for("comet")] = 6; - var keys = []; - for (var k in obj) - keys.push(k); - assertDeepEq(keys, ["x", "y", "z"]); - assertDeepEq(Object.keys(obj), ["x", "y", "z"]); +var keys = []; +for (var k in obj) + keys.push(k); +assertDeepEq(keys, ["x", "y", "z"]); +assertDeepEq(Object.keys(obj), ["x", "y", "z"]); - // Test with more properties. - for (var i = 0; i < 1000; i++) - obj[Symbol(i)] = i; - obj.w = 1000; - keys = [] - for (var k in obj) - keys.push(k); - assertDeepEq(keys, ["x", "y", "z", "w"]); -} +// Test with more properties. +for (var i = 0; i < 1000; i++) + obj[Symbol(i)] = i; +obj.w = 1000; +keys = [] +for (var k in obj) + keys.push(k); +assertDeepEq(keys, ["x", "y", "z", "w"]); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/for.js b/js/src/tests/ecma_6/Symbol/for.js index 7c9f0703735c..43e2855113ad 100644 --- a/js/src/tests/ecma_6/Symbol/for.js +++ b/js/src/tests/ecma_6/Symbol/for.js @@ -1,33 +1,31 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - // Symbol.for called twice with the same argument returns the same symbol. - assertEq(Symbol.for("ponies"), Symbol.for("ponies")); +// Symbol.for called twice with the same argument returns the same symbol. +assertEq(Symbol.for("ponies"), Symbol.for("ponies")); - // Called twice with equal strings: still the same result. - var one = Array(64+1).join("x"); - var two = Array(8+1).join(Array(8+1).join("x")); - assertEq(Symbol.for(one), Symbol.for(two)); +// Called twice with equal strings: still the same result. +var one = Array(64+1).join("x"); +var two = Array(8+1).join(Array(8+1).join("x")); +assertEq(Symbol.for(one), Symbol.for(two)); - // Symbols created by calling Symbol() are not in the symbol registry. - var sym = Symbol("123"); - assertEq(Symbol.for("123") !== sym, true); +// Symbols created by calling Symbol() are not in the symbol registry. +var sym = Symbol("123"); +assertEq(Symbol.for("123") !== sym, true); - // Empty string is fine. - assertEq(typeof Symbol.for(""), "symbol"); +// Empty string is fine. +assertEq(typeof Symbol.for(""), "symbol"); - // Primitive arguments. - assertEq(Symbol.for(3), Symbol.for("3")); - assertEq(Symbol.for(null), Symbol.for("null")); - assertEq(Symbol.for(undefined), Symbol.for("undefined")); - assertEq(Symbol.for(), Symbol.for("undefined")); +// Primitive arguments. +assertEq(Symbol.for(3), Symbol.for("3")); +assertEq(Symbol.for(null), Symbol.for("null")); +assertEq(Symbol.for(undefined), Symbol.for("undefined")); +assertEq(Symbol.for(), Symbol.for("undefined")); - // Symbol.for ignores the 'this' value. - var foo = Symbol.for("foo"); - assertEq(Symbol.for.call(String, "foo"), foo); - assertEq(Symbol.for.call(3.14, "foo"), foo); -} +// Symbol.for ignores the 'this' value. +var foo = Symbol.for("foo") +assertEq(Symbol.for.call(String, "foo"), foo); +assertEq(Symbol.for.call(3.14, "foo"), foo); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/json-stringify-keys.js b/js/src/tests/ecma_6/Symbol/json-stringify-keys.js index 3ff1a138829e..3818cbb339b5 100644 --- a/js/src/tests/ecma_6/Symbol/json-stringify-keys.js +++ b/js/src/tests/ecma_6/Symbol/json-stringify-keys.js @@ -1,21 +1,19 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - // JSON.stringify ignores symbol-keyed properties, even enumerable ones. +// JSON.stringify ignores symbol-keyed properties, even enumerable ones. - var obj = {a: 1}; - obj[Symbol.for("ponies")] = {toJSON: function () { throw "fit"; }}; - obj[Symbol.iterator] = {toJSON: function () { throw "fit"; }}; - assertEq(JSON.stringify(obj), '{"a":1}'); +var obj = {a: 1}; +obj[Symbol.for("ponies")] = {toJSON: function () { throw "fit"; }}; +obj[Symbol.iterator] = {toJSON: function () { throw "fit"; }}; +assertEq(JSON.stringify(obj), '{"a":1}'); - var replacer = function (k, v) { - if (typeof k === "symbol") - throw "fit"; - return v; - }; - assertEq(JSON.stringify(obj, replacer), '{"a":1}'); -} +var replacer = function (k, v) { + if (typeof k === "symbol") + throw "fit"; + return v; +}; +assertEq(JSON.stringify(obj, replacer), '{"a":1}'); if (typeof reportCompare === 'function') reportCompare(0, 0, 'ok'); diff --git a/js/src/tests/ecma_6/Symbol/json-stringify-values.js b/js/src/tests/ecma_6/Symbol/json-stringify-values.js index 1e85ff2dc404..0fe32eee5451 100644 --- a/js/src/tests/ecma_6/Symbol/json-stringify-values.js +++ b/js/src/tests/ecma_6/Symbol/json-stringify-values.js @@ -1,34 +1,32 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - // To JSON.stringify, symbols are the same as undefined. +// To JSON.stringify, symbols are the same as undefined. - var symbols = [ - Symbol(), - Symbol.for("ponies"), - Symbol.iterator - ]; +var symbols = [ + Symbol(), + Symbol.for("ponies"), + Symbol.iterator +]; - for (var sym of symbols) { - assertEq(JSON.stringify(sym), undefined); - assertEq(JSON.stringify([sym]), "[null]"); +for (var sym of symbols) { + assertEq(JSON.stringify(sym), undefined); + assertEq(JSON.stringify([sym]), "[null]"); - // JSON.stringify skips symbol-valued properties! - assertEq(JSON.stringify({x: sym}), '{}'); + // JSON.stringify skips symbol-valued properties! + assertEq(JSON.stringify({x: sym}), '{}'); - // However such properties are passed to the replacerFunction if any. - var replacer = function (key, val) { - assertEq(typeof this, "object"); - if (typeof val === "symbol") { - assertEq(val, sym); - return "ding"; - } - return val; - }; - assertEq(JSON.stringify(sym, replacer), '"ding"'); - assertEq(JSON.stringify({x: sym}, replacer), '{"x":"ding"}'); - } + // However such properties are passed to the replacerFunction if any. + var replacer = function (key, val) { + assertEq(typeof this, "object"); + if (typeof val === "symbol") { + assertEq(val, sym); + return "ding"; + } + return val; + }; + assertEq(JSON.stringify(sym, replacer), '"ding"'); + assertEq(JSON.stringify({x: sym}, replacer), '{"x":"ding"}'); } if (typeof reportCompare === 'function') diff --git a/js/src/tests/ecma_6/Symbol/keyFor.js b/js/src/tests/ecma_6/Symbol/keyFor.js index 3a4b8a00b9e0..868c3bda7405 100644 --- a/js/src/tests/ecma_6/Symbol/keyFor.js +++ b/js/src/tests/ecma_6/Symbol/keyFor.js @@ -1,17 +1,15 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - assertEq(Symbol.keyFor(Symbol.for("moon")), "moon"); - assertEq(Symbol.keyFor(Symbol.for("")), ""); - assertEq(Symbol.keyFor(Symbol("moon")), undefined); - assertEq(Symbol.keyFor(Symbol.iterator), undefined); +assertEq(Symbol.keyFor(Symbol.for("moon")), "moon"); +assertEq(Symbol.keyFor(Symbol.for("")), ""); +assertEq(Symbol.keyFor(Symbol("moon")), undefined); +assertEq(Symbol.keyFor(Symbol.iterator), undefined); - assertThrowsInstanceOf(() => Symbol.keyFor(), TypeError); - assertThrowsInstanceOf(() => Symbol.keyFor(Object(Symbol("moon"))), TypeError); +assertThrowsInstanceOf(() => Symbol.keyFor(), TypeError); +assertThrowsInstanceOf(() => Symbol.keyFor(Object(Symbol("moon"))), TypeError); - assertEq(Symbol.keyFor.length, 1); -} +assertEq(Symbol.keyFor.length, 1); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/property-accessor.js b/js/src/tests/ecma_6/Symbol/property-accessor.js index 90db87586b51..7a2c149a1e32 100644 --- a/js/src/tests/ecma_6/Symbol/property-accessor.js +++ b/js/src/tests/ecma_6/Symbol/property-accessor.js @@ -1,41 +1,39 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - var obj = {}; - var sym = Symbol(); +var obj = {}; +var sym = Symbol(); - var gets = 0; - var sets = []; - Object.defineProperty(obj, sym, { - get: function () { return ++gets; }, - set: function (v) { sets.push(v); } - }); +var gets = 0; +var sets = []; +Object.defineProperty(obj, sym, { + get: function () { return ++gets; }, + set: function (v) { sets.push(v); } +}); - // getter - for (var i = 1; i < 9; i++) - assertEq(obj[sym], i); +// getter +for (var i = 1; i < 9; i++) + assertEq(obj[sym], i); - // setter - var expected = []; - for (var i = 0; i < 9; i++) { - assertEq(obj[sym] = i, i); - expected.push(i); - } - assertDeepEq(sets, expected); - - // increment operator - gets = 0; - sets = []; - assertEq(obj[sym]++, 1); - assertDeepEq(sets, [2]); - - // assignment - gets = 0; - sets = []; - assertEq(obj[sym] *= 12, 12); - assertDeepEq(sets, [12]); +// setter +var expected = []; +for (var i = 0; i < 9; i++) { + assertEq(obj[sym] = i, i); + expected.push(i); } +assertDeepEq(sets, expected); + +// increment operator +gets = 0; +sets = []; +assertEq(obj[sym]++, 1); +assertDeepEq(sets, [2]); + +// assignment +gets = 0; +sets = []; +assertEq(obj[sym] *= 12, 12); +assertDeepEq(sets, [12]); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/property-basics.js b/js/src/tests/ecma_6/Symbol/property-basics.js index 9d9ec8e39a5a..a38fa717abb8 100644 --- a/js/src/tests/ecma_6/Symbol/property-basics.js +++ b/js/src/tests/ecma_6/Symbol/property-basics.js @@ -1,45 +1,43 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - var symbols = [ - Symbol(), - Symbol("one"), - Symbol.for("two"), - Symbol.iterator, - Object(Symbol()) - ]; +var symbols = [ + Symbol(), + Symbol("one"), + Symbol.for("two"), + Symbol.iterator, + Object(Symbol()) +]; - for (var sym of symbols) { - var obj = {}; +for (var sym of symbols) { + var obj = {}; - // access a nonexistent property - assertEq(sym in obj, false); - assertEq(obj.hasOwnProperty(sym), false); - assertEq(obj[sym], undefined); - assertEq(typeof obj[sym], "undefined"); - assertEq(Object.getOwnPropertyDescriptor(obj, sym), undefined); + // access a nonexistent property + assertEq(sym in obj, false); + assertEq(obj.hasOwnProperty(sym), false); + assertEq(obj[sym], undefined); + assertEq(typeof obj[sym], "undefined"); + assertEq(Object.getOwnPropertyDescriptor(obj, sym), undefined); - // assign, then try accessing again - obj[sym] = "ok"; - assertEq(sym in obj, true); - assertEq(obj.hasOwnProperty(sym), true); - assertEq(obj[sym], "ok"); - assertDeepEq(Object.getOwnPropertyDescriptor(obj, sym), { - configurable: true, - enumerable: true, - value: "ok", - writable: true - }); + // assign, then try accessing again + obj[sym] = "ok"; + assertEq(sym in obj, true); + assertEq(obj.hasOwnProperty(sym), true); + assertEq(obj[sym], "ok"); + assertDeepEq(Object.getOwnPropertyDescriptor(obj, sym), { + configurable: true, + enumerable: true, + value: "ok", + writable: true + }); - // assign again, observe value is overwritten - obj[sym] = 12; - assertEq(obj[sym], 12); + // assign again, observe value is overwritten + obj[sym] = 12; + assertEq(obj[sym], 12); - // increment - assertEq(obj[sym]++, 12); - assertEq(obj[sym], 13); - } + // increment + assertEq(obj[sym]++, 12); + assertEq(obj[sym], 13); } if (typeof reportCompare === "function") diff --git a/js/src/tests/ecma_6/Symbol/property-inheritance.js b/js/src/tests/ecma_6/Symbol/property-inheritance.js index d0aa51abf815..2fe618968989 100644 --- a/js/src/tests/ecma_6/Symbol/property-inheritance.js +++ b/js/src/tests/ecma_6/Symbol/property-inheritance.js @@ -1,53 +1,50 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ +var sym = Symbol.for("hello"); function F() {} +var f = new F(); -if (typeof Symbol === "function") { - var sym = Symbol.for("hello"); - var f = new F(); +// inherited data property +F.prototype[sym] = "world"; +assertEq(sym in f, true); +assertEq(f.hasOwnProperty(sym), false); +assertEq(f[sym], "world"); - // inherited data property - F.prototype[sym] = "world"; - assertEq(sym in f, true); - assertEq(f.hasOwnProperty(sym), false); - assertEq(f[sym], "world"); +// shadowing assignment +f[sym] = "kitty"; +assertEq(f[sym], "kitty"); +assertEq(F.prototype[sym], "world"); - // shadowing assignment - f[sym] = "kitty"; - assertEq(f[sym], "kitty"); - assertEq(F.prototype[sym], "world"); +// deletion, revealing previously shadowed property +assertEq(delete f[sym], true); +assertEq(f.hasOwnProperty(sym), false); +assertEq(f[sym], "world"); - // deletion, revealing previously shadowed property - assertEq(delete f[sym], true); - assertEq(f.hasOwnProperty(sym), false); - assertEq(f[sym], "world"); +// inherited accessor property +var value = undefined; +Object.defineProperty(F.prototype, sym, { + configurable: true, + get: function () { return 23; }, + set: function (v) { value = v; } +}); +assertEq(sym in f, true); +assertEq(f.hasOwnProperty(sym), false); +assertEq(f[sym], 23); +f[sym] = "gravity"; +assertEq(value, "gravity"); - // inherited accessor property - var value = undefined; - Object.defineProperty(F.prototype, sym, { - configurable: true, - get: function () { return 23; }, - set: function (v) { value = v; } - }); - assertEq(sym in f, true); - assertEq(f.hasOwnProperty(sym), false); - assertEq(f[sym], 23); - f[sym] = "gravity"; - assertEq(value, "gravity"); +// inherited accessor property with no setter +Object.defineProperty(F.prototype, sym, { + set: undefined +}); +assertThrowsInstanceOf(function () { "use strict"; f[sym] = 0; }, TypeError); - // inherited accessor property with no setter - Object.defineProperty(F.prototype, sym, { - set: undefined - }); - assertThrowsInstanceOf(function () { "use strict"; f[sym] = 0; }, TypeError); - - // deeply inherited accessor property - var g = Object.create(f); - for (var i = 0; i < 100; i++) - g = Object.create(g); - assertEq(g[sym], 23); -} +// deeply inherited accessor property +var g = Object.create(f); +for (var i = 0; i < 100; i++) + g = Object.create(g); +assertEq(g[sym], 23); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/property-nonwritable.js b/js/src/tests/ecma_6/Symbol/property-nonwritable.js index 221684e8360f..3e58383c785d 100644 --- a/js/src/tests/ecma_6/Symbol/property-nonwritable.js +++ b/js/src/tests/ecma_6/Symbol/property-nonwritable.js @@ -1,6 +1,7 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ +var sym = Symbol.for("moon"); function checkNotWritable(obj) { // In sloppy mode, assigning to a nonwritable property silently fails. obj[sym] = "portals"; @@ -11,24 +12,20 @@ function checkNotWritable(obj) { assertEq(obj[sym], "cheese"); } -if (typeof Symbol === "function") { - var sym = Symbol.for("moon"); +var x = {}; +Object.defineProperty(x, sym, { + configurable: true, + enumerable: true, + value: "cheese", + writable: false +}); - var x = {}; - Object.defineProperty(x, sym, { - configurable: true, - enumerable: true, - value: "cheese", - writable: false - }); +checkNotWritable(x); - checkNotWritable(x); - - // Assignment can't shadow inherited nonwritable properties either. - var y = Object.create(x); - checkNotWritable(y); - checkNotWritable(Object.create(y)); -} +// Assignment can't shadow inherited nonwritable properties either. +var y = Object.create(x); +checkNotWritable(y); +checkNotWritable(Object.create(y)); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/property-reflection.js b/js/src/tests/ecma_6/Symbol/property-reflection.js index 43bd5dffdb38..a70a43fb9880 100644 --- a/js/src/tests/ecma_6/Symbol/property-reflection.js +++ b/js/src/tests/ecma_6/Symbol/property-reflection.js @@ -1,139 +1,136 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ +// Basic tests for standard Object APIs interacting with symbols. + +// Object.defineProperty function F() {} +var f = new F; +Object.defineProperty(f, Symbol.for("name"), { + configurable: true, + value: "eff" +}); +assertEq("name" in f, false); +assertEq("Symbol(name)" in f, false); +assertEq(Symbol.for("name") in f, true); +assertEq(f[Symbol.for("name")], "eff"); + +// Object.defineProperties function D() {} +var descs = new D; +var s1 = Symbol("s1"); +var hits = 0; +descs[s1] = { + configurable: true, + enumerable: true, + get: () => hits++, + set: undefined +}; +var s2 = Symbol("s2"); +descs[s2] = { + configurable: true, + enumerable: false, + value: {}, + writable: true +}; +var s3 = Symbol("s3"); +D.prototype[s3] = {value: "FAIL"}; +assertEq(Object.defineProperties(f, descs), f); +assertEq(s1 in f, true); +assertEq(f[s1], 0); +assertEq(hits, 1); +assertEq(s2 in f, true); +assertEq(f[s2], descs[s2].value); +assertEq(s3 in f, false); -if (typeof Symbol === "function") { - // Basic tests for standard Object APIs interacting with symbols. +// Object.create +var n = Object.create({}, descs); +assertEq(s1 in n, true); +assertEq(n[s1], 1); +assertEq(hits, 2); +assertEq(s2 in n, true); +assertEq(n[s2], descs[s2].value); +assertEq(s3 in n, false); - // Object.defineProperty - var f = new F; - Object.defineProperty(f, Symbol.for("name"), { - configurable: true, - value: "eff" - }); - assertEq("name" in f, false); - assertEq("Symbol(name)" in f, false); - assertEq(Symbol.for("name") in f, true); - assertEq(f[Symbol.for("name")], "eff"); +// Object.getOwnPropertyDescriptor +var desc = Object.getOwnPropertyDescriptor(n, s1); +assertDeepEq(desc, descs[s1]); +assertEq(desc.get, descs[s1].get); +desc = Object.getOwnPropertyDescriptor(n, s2); +assertDeepEq(desc, descs[s2]); +assertEq(desc.value, descs[s2].value); - // Object.defineProperties - var descs = new D; - var s1 = Symbol("s1"); - var hits = 0; - descs[s1] = { - configurable: true, - enumerable: true, - get: () => hits++, - set: undefined - }; - var s2 = Symbol("s2"); - descs[s2] = { - configurable: true, - enumerable: false, - value: {}, - writable: true - }; - var s3 = Symbol("s3"); - D.prototype[s3] = {value: "FAIL"}; - assertEq(Object.defineProperties(f, descs), f); - assertEq(s1 in f, true); - assertEq(f[s1], 0); - assertEq(hits, 1); - assertEq(s2 in f, true); - assertEq(f[s2], descs[s2].value); - assertEq(s3 in f, false); +// Object.prototype.hasOwnProperty +assertEq(descs.hasOwnProperty(s1), true); +assertEq(descs.hasOwnProperty(s2), true); +assertEq(descs.hasOwnProperty(s3), false); +assertEq([].hasOwnProperty(Symbol.iterator), false); +assertEq(Array.prototype.hasOwnProperty(Symbol.iterator), true); - // Object.create - var n = Object.create({}, descs); - assertEq(s1 in n, true); - assertEq(n[s1], 1); - assertEq(hits, 2); - assertEq(s2 in n, true); - assertEq(n[s2], descs[s2].value); - assertEq(s3 in n, false); +// Object.prototype.propertyIsEnumerable +assertEq(n.propertyIsEnumerable(s1), true); +assertEq(n.propertyIsEnumerable(s2), false); +assertEq(n.propertyIsEnumerable(s3), false); // no such property +assertEq(D.prototype.propertyIsEnumerable(s3), true); +assertEq(descs.propertyIsEnumerable(s3), false); // inherited properties are not considered - // Object.getOwnPropertyDescriptor - var desc = Object.getOwnPropertyDescriptor(n, s1); - assertDeepEq(desc, descs[s1]); - assertEq(desc.get, descs[s1].get); - desc = Object.getOwnPropertyDescriptor(n, s2); - assertDeepEq(desc, descs[s2]); - assertEq(desc.value, descs[s2].value); +// Object.preventExtensions +var obj = {}; +obj[s1] = 1; +assertEq(Object.preventExtensions(obj), obj); +assertThrowsInstanceOf(function () { "use strict"; obj[s2] = 2; }, TypeError); +obj[s2] = 2; // still no effect +assertEq(s2 in obj, false); - // Object.prototype.hasOwnProperty - assertEq(descs.hasOwnProperty(s1), true); - assertEq(descs.hasOwnProperty(s2), true); - assertEq(descs.hasOwnProperty(s3), false); - assertEq([].hasOwnProperty(Symbol.iterator), false); - assertEq(Array.prototype.hasOwnProperty(Symbol.iterator), true); +// Object.isSealed, Object.isFrozen +assertEq(Object.isSealed(obj), false); +assertEq(Object.isFrozen(obj), false); +assertEq(delete obj[s1], true); +assertEq(Object.isSealed(obj), true); +assertEq(Object.isFrozen(obj), true); - // Object.prototype.propertyIsEnumerable - assertEq(n.propertyIsEnumerable(s1), true); - assertEq(n.propertyIsEnumerable(s2), false); - assertEq(n.propertyIsEnumerable(s3), false); // no such property - assertEq(D.prototype.propertyIsEnumerable(s3), true); - assertEq(descs.propertyIsEnumerable(s3), false); // inherited properties are not considered +obj = {}; +obj[s1] = 1; +Object.preventExtensions(obj); +Object.defineProperty(obj, s1, {configurable: false}); // still writable +assertEq(Object.isSealed(obj), true); +assertEq(Object.isFrozen(obj), false); +obj[s1] = 2; +assertEq(obj[s1], 2); +Object.defineProperty(obj, s1, {writable: false}); +assertEq(Object.isFrozen(obj), true); - // Object.preventExtensions - var obj = {}; - obj[s1] = 1; - assertEq(Object.preventExtensions(obj), obj); - assertThrowsInstanceOf(function () { "use strict"; obj[s2] = 2; }, TypeError); - obj[s2] = 2; // still no effect - assertEq(s2 in obj, false); +// Object.seal, Object.freeze +var obj = {}; +obj[s1] = 1; +Object.seal(obj); +desc = Object.getOwnPropertyDescriptor(obj, s1); +assertEq(desc.configurable, false); +assertEq(desc.writable, true); +Object.freeze(obj); +assertEq(Object.getOwnPropertyDescriptor(obj, s1).writable, false); - // Object.isSealed, Object.isFrozen - assertEq(Object.isSealed(obj), false); - assertEq(Object.isFrozen(obj), false); - assertEq(delete obj[s1], true); - assertEq(Object.isSealed(obj), true); - assertEq(Object.isFrozen(obj), true); - - obj = {}; - obj[s1] = 1; - Object.preventExtensions(obj); - Object.defineProperty(obj, s1, {configurable: false}); // still writable - assertEq(Object.isSealed(obj), true); - assertEq(Object.isFrozen(obj), false); - obj[s1] = 2; - assertEq(obj[s1], 2); - Object.defineProperty(obj, s1, {writable: false}); - assertEq(Object.isFrozen(obj), true); - - // Object.seal, Object.freeze - var obj = {}; - obj[s1] = 1; - Object.seal(obj); - desc = Object.getOwnPropertyDescriptor(obj, s1); - assertEq(desc.configurable, false); - assertEq(desc.writable, true); - Object.freeze(obj); - assertEq(Object.getOwnPropertyDescriptor(obj, s1).writable, false); - - // Object.setPrototypeOf purges caches for symbol-keyed properties. - var proto = {}; - proto[s1] = 1; - Object.defineProperty(proto, s2, { - get: () => 2, - set: v => undefined - }); - var obj = Object.create(proto); - var last1, last2; - var N = 9; - for (var i = 0; i < N; i++) { - last1 = obj[s1]; - last2 = obj[s2]; - obj[s2] = "marker"; - if (i === N - 2) - Object.setPrototypeOf(obj, {}); - } - assertEq(last1, undefined); - assertEq(last2, undefined); - assertEq(obj.hasOwnProperty(s2), true); - assertEq(obj[s2], "marker"); +// Object.setPrototypeOf purges caches for symbol-keyed properties. +var proto = {}; +proto[s1] = 1; +Object.defineProperty(proto, s2, { + get: () => 2, + set: v => undefined +}); +var obj = Object.create(proto); +var last1, last2; +var N = 9; +for (var i = 0; i < N; i++) { + last1 = obj[s1]; + last2 = obj[s2]; + obj[s2] = "marker"; + if (i === N - 2) + Object.setPrototypeOf(obj, {}); } +assertEq(last1, undefined); +assertEq(last2, undefined); +assertEq(obj.hasOwnProperty(s2), true); +assertEq(obj[s2], "marker"); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/realms.js b/js/src/tests/ecma_6/Symbol/realms.js index b4d98eaa3109..98a1284ee060 100644 --- a/js/src/tests/ecma_6/Symbol/realms.js +++ b/js/src/tests/ecma_6/Symbol/realms.js @@ -1,37 +1,35 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - // Symbols can be shared across realms. +// Symbols can be shared across realms. - if (typeof Reflect !== "undefined" && typeof Reflect.Realm === "function") { - throw new Error("Congratulations on implementing Reflect.Realm! " + - "Please update this test to use it."); - } - if (typeof newGlobal === "function") { - var g = newGlobal(); - var gj = g.eval("jones = Symbol('jones')"); - assertEq(typeof gj, "symbol"); - assertEq(g.jones, g.jones); - assertEq(gj, g.jones); - assertEq(gj !== Symbol("jones"), true); +if (typeof Reflect !== "undefined" && typeof Reflect.Realm === "function") { + throw new Error("Congratulations on implementing Reflect.Realm! " + + "Please update this test to use it."); +} +if (typeof newGlobal === "function") { + var g = newGlobal(); + var gj = g.eval("jones = Symbol('jones')"); + assertEq(typeof gj, "symbol"); + assertEq(g.jones, g.jones); + assertEq(gj, g.jones); + assertEq(gj !== Symbol("jones"), true); - // A symbol can be round-tripped to another realm and back; - // the result is the original symbol. - var smith = Symbol("smith"); - g.smith = smith; // put smith into the realm - assertEq(g.smith, smith); // pull it back out + // A symbol can be round-tripped to another realm and back; + // the result is the original symbol. + var smith = Symbol("smith"); + g.smith = smith; // put smith into the realm + assertEq(g.smith, smith); // pull it back out - // Spot-check that non-generic methods can be applied to symbols and Symbol - // objects from other realms. - assertEq(Symbol.prototype.toString.call(gj), "Symbol(jones)"); - assertEq(Symbol.prototype.toString.call(g.eval("Object(Symbol('brown'))")), - "Symbol(brown)"); + // Spot-check that non-generic methods can be applied to symbols and Symbol + // objects from other realms. + assertEq(Symbol.prototype.toString.call(gj), "Symbol(jones)"); + assertEq(Symbol.prototype.toString.call(g.eval("Object(Symbol('brown'))")), + "Symbol(brown)"); - // Symbol.for functions share a symbol registry across all realms. - assertEq(g.Symbol.for("ponies"), Symbol.for("ponies")); - assertEq(g.eval("Symbol.for('rainbows')"), Symbol.for("rainbows")); - } + // Symbol.for functions share a symbol registry across all realms. + assertEq(g.Symbol.for("ponies"), Symbol.for("ponies")); + assertEq(g.eval("Symbol.for('rainbows')"), Symbol.for("rainbows")); } if (typeof reportCompare === "function") diff --git a/js/src/tests/ecma_6/Symbol/surfaces.js b/js/src/tests/ecma_6/Symbol/surfaces.js index c318a939c57a..0c0c2021f83f 100644 --- a/js/src/tests/ecma_6/Symbol/surfaces.js +++ b/js/src/tests/ecma_6/Symbol/surfaces.js @@ -1,36 +1,34 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - // Test superficial properties of the Symbol constructor and prototype. +// Test superficial properties of the Symbol constructor and prototype. - var desc = Object.getOwnPropertyDescriptor(this, "Symbol"); - assertEq(desc.configurable, true); - assertEq(desc.enumerable, false); - assertEq(desc.writable, true); - assertEq(typeof Symbol, "function"); - assertEq(Symbol.length, 1); +var desc = Object.getOwnPropertyDescriptor(this, "Symbol"); +assertEq(desc.configurable, true); +assertEq(desc.enumerable, false); +assertEq(desc.writable, true); +assertEq(typeof Symbol, "function"); +assertEq(Symbol.length, 1); - desc = Object.getOwnPropertyDescriptor(Symbol, "prototype"); - assertEq(desc.configurable, false); - assertEq(desc.enumerable, false); - assertEq(desc.writable, false); +desc = Object.getOwnPropertyDescriptor(Symbol, "prototype"); +assertEq(desc.configurable, false); +assertEq(desc.enumerable, false); +assertEq(desc.writable, false); - assertEq(Symbol.prototype.constructor, Symbol); - desc = Object.getOwnPropertyDescriptor(Symbol.prototype, "constructor"); - assertEq(desc.configurable, true); - assertEq(desc.enumerable, false); - assertEq(desc.writable, true); +assertEq(Symbol.prototype.constructor, Symbol); +desc = Object.getOwnPropertyDescriptor(Symbol.prototype, "constructor"); +assertEq(desc.configurable, true); +assertEq(desc.enumerable, false); +assertEq(desc.writable, true); - desc = Object.getOwnPropertyDescriptor(Symbol, "iterator"); - assertEq(desc.configurable, false); - assertEq(desc.enumerable, false); - assertEq(desc.writable, false); +desc = Object.getOwnPropertyDescriptor(Symbol, "iterator"); +assertEq(desc.configurable, false); +assertEq(desc.enumerable, false); +assertEq(desc.writable, false); - assertEq(Symbol.for.length, 1); - assertEq(Symbol.prototype.toString.length, 0); - assertEq(Symbol.prototype.valueOf.length, 0); -} +assertEq(Symbol.for.length, 1); +assertEq(Symbol.prototype.toString.length, 0); +assertEq(Symbol.prototype.valueOf.length, 0); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/toString.js b/js/src/tests/ecma_6/Symbol/toString.js index 7835dbe0e0a0..b7bbda876272 100644 --- a/js/src/tests/ecma_6/Symbol/toString.js +++ b/js/src/tests/ecma_6/Symbol/toString.js @@ -1,29 +1,27 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - var cases = [ - {sym: Symbol(), str: "Symbol()"}, - {sym: Symbol("ok"), str: "Symbol(ok)"}, - {sym: Symbol("\0"), str: "Symbol(\0)"}, - {sym: Symbol.iterator, str: "Symbol(Symbol.iterator)"}, - {sym: Symbol.for("dummies"), str: "Symbol(dummies)"} - ]; +var cases = [ + {sym: Symbol(), str: "Symbol()"}, + {sym: Symbol("ok"), str: "Symbol(ok)"}, + {sym: Symbol("\0"), str: "Symbol(\0)"}, + {sym: Symbol.iterator, str: "Symbol(Symbol.iterator)"}, + {sym: Symbol.for("dummies"), str: "Symbol(dummies)"} +]; - // Symbol.prototype.toString works on both primitive symbols and Symbol - // objects. - for (var test of cases) { - assertEq(test.sym.toString(), test.str); - assertEq(Object(test.sym).toString(), test.str); - } - - // Any other value throws. - var nonsymbols = [ - undefined, null, "not-ok", new String("still-not-ok"), {}, [] - ]; - for (var nonsym of nonsymbols) - assertThrowsInstanceOf(() => Symbol.prototype.toString.call(nonsym), TypeError); +// Symbol.prototype.toString works on both primitive symbols and Symbol +// objects. +for (var test of cases) { + assertEq(test.sym.toString(), test.str); + assertEq(Object(test.sym).toString(), test.str); } +// Any other value throws. +var nonsymbols = [ + undefined, null, "not-ok", new String("still-not-ok"), {}, [] +]; +for (var nonsym of nonsymbols) + assertThrowsInstanceOf(() => Symbol.prototype.toString.call(nonsym), TypeError); + if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/typed-arrays.js b/js/src/tests/ecma_6/Symbol/typed-arrays.js index 4b1dce951bb4..a07cf396bb8b 100644 --- a/js/src/tests/ecma_6/Symbol/typed-arrays.js +++ b/js/src/tests/ecma_6/Symbol/typed-arrays.js @@ -1,18 +1,16 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - // Symbol-to-number type conversions involving typed arrays. +// Symbol-to-number type conversions involving typed arrays. - for (var T of [Uint8Array, Uint8ClampedArray, Int16Array, Float32Array]) { - // Typed array constructors convert symbols using ToNumber(), which throws. - assertThrowsInstanceOf(() => new T([Symbol("a")]), TypeError); +for (var T of [Uint8Array, Uint8ClampedArray, Int16Array, Float32Array]) { + // Typed array constructors convert symbols using ToNumber(), which throws. + assertThrowsInstanceOf(() => new T([Symbol("a")]), TypeError); - // Assignment does the same. - var arr = new T([1]); - assertThrowsInstanceOf(() => { arr[0] = Symbol.iterator; }, TypeError); - assertEq(arr[0], 1); - } + // Assignment does the same. + var arr = new T([1]); + assertThrowsInstanceOf(() => { arr[0] = Symbol.iterator; }, TypeError); + assertEq(arr[0], 1); } if (typeof reportCompare === "function") diff --git a/js/src/tests/ecma_6/Symbol/typeof.js b/js/src/tests/ecma_6/Symbol/typeof.js index 61688ed2c182..104ae66dfde1 100644 --- a/js/src/tests/ecma_6/Symbol/typeof.js +++ b/js/src/tests/ecma_6/Symbol/typeof.js @@ -1,13 +1,11 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - assertEq(typeof Symbol(), "symbol"); - assertEq(typeof Symbol("ponies"), "symbol"); - assertEq(typeof Symbol.for("ponies"), "symbol"); +assertEq(typeof Symbol(), "symbol"); +assertEq(typeof Symbol("ponies"), "symbol"); +assertEq(typeof Symbol.for("ponies"), "symbol"); - assertEq(typeof Object(Symbol()), "object"); -} +assertEq(typeof Object(Symbol()), "object"); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/valueOf.js b/js/src/tests/ecma_6/Symbol/valueOf.js index 3f6653a3e79e..a3823c3ffd39 100644 --- a/js/src/tests/ecma_6/Symbol/valueOf.js +++ b/js/src/tests/ecma_6/Symbol/valueOf.js @@ -1,24 +1,22 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - var symbols = [ - Symbol(), - Symbol("ok"), - Symbol.for("dummies"), - Symbol.iterator - ]; +var symbols = [ + Symbol(), + Symbol("ok"), + Symbol.for("dummies"), + Symbol.iterator +]; - for (var sym of symbols) { - assertEq(sym.valueOf(), sym); - assertEq(Object(sym).valueOf(), sym); - } - - // Any other value throws. - var nonsymbols = [undefined, null, NaN, {}, Symbol.prototype]; - for (var nonsym of nonsymbols) - assertThrowsInstanceOf(() => Symbol.prototype.valueOf.call(nonsym), TypeError); +for (var sym of symbols) { + assertEq(sym.valueOf(), sym); + assertEq(Object(sym).valueOf(), sym); } +// Any other value throws. +var nonsymbols = [undefined, null, NaN, {}, Symbol.prototype]; +for (var nonsym of nonsymbols) + assertThrowsInstanceOf(() => Symbol.prototype.valueOf.call(nonsym), TypeError); + if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/Symbol/well-known.js b/js/src/tests/ecma_6/Symbol/well-known.js index b7002585389e..e61ef1836956 100644 --- a/js/src/tests/ecma_6/Symbol/well-known.js +++ b/js/src/tests/ecma_6/Symbol/well-known.js @@ -1,20 +1,18 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - // Well-known symbols exist. - assertEq(typeof Symbol.iterator, "symbol"); +// Well-known symbols exist. +assertEq(typeof Symbol.iterator, "symbol"); - // They are never in the registry. - assertEq(Symbol.iterator !== Symbol.for("Symbol.iterator"), true); +// They are never in the registry. +assertEq(Symbol.iterator !== Symbol.for("Symbol.iterator"), true); - // They are shared across realms. - if (typeof Realm === 'function') - throw new Error("please update this test to use Realms"); - if (typeof newGlobal === 'function') { - var g = newGlobal(); - assertEq(Symbol.iterator, g.Symbol.iterator); - } +// They are shared across realms. +if (typeof Realm === 'function') + throw new Error("please update this test to use Realms"); +if (typeof newGlobal === 'function') { + var g = newGlobal(); + assertEq(Symbol.iterator, g.Symbol.iterator); } if (typeof reportCompare === "function") diff --git a/js/src/tests/ecma_6/WeakMap/symbols.js b/js/src/tests/ecma_6/WeakMap/symbols.js index ae49ccda6b2d..68d6518f2a24 100644 --- a/js/src/tests/ecma_6/WeakMap/symbols.js +++ b/js/src/tests/ecma_6/WeakMap/symbols.js @@ -1,12 +1,10 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - // Symbols can't be WeakMap keys. - var m = new WeakMap; - var sym = Symbol(); - assertThrowsInstanceOf(() => m.set(sym, 0), TypeError); -} +// Symbols can't be WeakMap keys. +var m = new WeakMap; +var sym = Symbol(); +assertThrowsInstanceOf(() => m.set(sym, 0), TypeError); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/ecma_6/shell.js b/js/src/tests/ecma_6/shell.js index f47e781084a8..d9d777fdd474 100644 --- a/js/src/tests/ecma_6/shell.js +++ b/js/src/tests/ecma_6/shell.js @@ -45,6 +45,7 @@ if (typeof assertDeepEq === 'undefined') { Array_isArray = Array.isArray, Map_ = Map, Error_ = Error, + Symbol_ = Symbol, Map_has = call.bind(Map.prototype.has), Map_get = call.bind(Map.prototype.get), Map_set = call.bind(Map.prototype.set), diff --git a/js/src/tests/js1_8_5/extensions/noSuchMethod-symbols.js b/js/src/tests/js1_8_5/extensions/noSuchMethod-symbols.js index 88af972132a4..01ebc77e7308 100644 --- a/js/src/tests/js1_8_5/extensions/noSuchMethod-symbols.js +++ b/js/src/tests/js1_8_5/extensions/noSuchMethod-symbols.js @@ -1,21 +1,19 @@ // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ -if (typeof Symbol === "function") { - var sym = Symbol("method"); - var hits = 0; - var obj = { - __noSuchMethod__: function (key, args) { - assertEq(key, sym); - assertEq(args.length, 2); - assertEq(args[0], "hello"); - assertEq(args[1], "world"); - hits++; - } - }; - obj[sym]("hello", "world"); - assertEq(hits, 1); -} +var sym = Symbol("method"); +var hits = 0; +var obj = { + __noSuchMethod__: function (key, args) { + assertEq(key, sym); + assertEq(args.length, 2); + assertEq(args[0], "hello"); + assertEq(args[1], "world"); + hits++; + } +}; +obj[sym]("hello", "world"); +assertEq(hits, 1); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/js1_8_5/extensions/object-toSource-with-symbol-keys.js b/js/src/tests/js1_8_5/extensions/object-toSource-with-symbol-keys.js index e97f57f3f105..cbd019e1ef0f 100644 --- a/js/src/tests/js1_8_5/extensions/object-toSource-with-symbol-keys.js +++ b/js/src/tests/js1_8_5/extensions/object-toSource-with-symbol-keys.js @@ -1,16 +1,14 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ -if (typeof Symbol === "function") { - var obj = {}; - obj[Symbol.iterator] = 1; - assertEq(obj.toSource(), "({[Symbol.iterator]:1})"); - obj[Symbol(undefined)] = 2; - obj[Symbol('ponies')] = 3; - obj[Symbol.for('ponies')] = 4; - assertEq(obj.toSource(), - '({[Symbol.iterator]:1, [Symbol()]:2, [Symbol("ponies")]:3, [Symbol.for("ponies")]:4})'); -} +var obj = {}; +obj[Symbol.iterator] = 1; +assertEq(obj.toSource(), "({[Symbol.iterator]:1})"); +obj[Symbol(undefined)] = 2; +obj[Symbol('ponies')] = 3; +obj[Symbol.for('ponies')] = 4; +assertEq(obj.toSource(), + '({[Symbol.iterator]:1, [Symbol()]:2, [Symbol("ponies")]:3, [Symbol.for("ponies")]:4})'); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/js/src/tests/js1_8_5/extensions/symbol-uneval.js b/js/src/tests/js1_8_5/extensions/symbol-uneval.js index 7e1243e395f5..a1c2a9097ee4 100644 --- a/js/src/tests/js1_8_5/extensions/symbol-uneval.js +++ b/js/src/tests/js1_8_5/extensions/symbol-uneval.js @@ -1,15 +1,13 @@ // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ -if (typeof Symbol === "function") { - assertEq(uneval(Symbol.iterator), "Symbol.iterator"); - assertEq(uneval(Symbol()), "Symbol()"); - assertEq(uneval(Symbol("")), 'Symbol("")'); - assertEq(uneval(Symbol("ponies")), 'Symbol("ponies")'); - assertEq(uneval(Symbol.for("ponies")), 'Symbol.for("ponies")'); +assertEq(uneval(Symbol.iterator), "Symbol.iterator"); +assertEq(uneval(Symbol()), "Symbol()"); +assertEq(uneval(Symbol("")), 'Symbol("")'); +assertEq(uneval(Symbol("ponies")), 'Symbol("ponies")'); +assertEq(uneval(Symbol.for("ponies")), 'Symbol.for("ponies")'); - assertEq({glyph: Symbol(undefined)}.toSource(), "({glyph:Symbol()})"); -} +assertEq({glyph: Symbol(undefined)}.toSource(), "({glyph:Symbol()})"); if (typeof reportCompare === "function") reportCompare(0, 0); diff --git a/toolkit/devtools/server/actors/script.js b/toolkit/devtools/server/actors/script.js index 7a8f970f57d0..e458948e5994 100644 --- a/toolkit/devtools/server/actors/script.js +++ b/toolkit/devtools/server/actors/script.js @@ -5813,7 +5813,7 @@ function getInnerId(window) { getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID; }; -const symbolProtoToString = typeof Symbol === "function" ? Symbol.prototype.toString : null; +const symbolProtoToString = Symbol.prototype.toString; function getSymbolName(symbol) { const name = symbolProtoToString.call(symbol).slice("Symbol(".length, -1); diff --git a/toolkit/devtools/server/tests/unit/test_symbols-01.js b/toolkit/devtools/server/tests/unit/test_symbols-01.js index 3c3b9eb2ce4f..0976a998a73e 100644 --- a/toolkit/devtools/server/tests/unit/test_symbols-01.js +++ b/toolkit/devtools/server/tests/unit/test_symbols-01.js @@ -23,12 +23,6 @@ function run_test() { } function* testSymbols(client, debuggee) { - // Symbol is conditionally defined. If it isn't defined in this build, just pass. - if (typeof Symbol === "undefined") { - finishClient(client); - return; - } - const evalCode = () => { Components.utils.evalInSandbox( "(" + function () { diff --git a/toolkit/devtools/server/tests/unit/test_symbols-02.js b/toolkit/devtools/server/tests/unit/test_symbols-02.js index b0788f451511..95753d6ddbb1 100644 --- a/toolkit/devtools/server/tests/unit/test_symbols-02.js +++ b/toolkit/devtools/server/tests/unit/test_symbols-02.js @@ -23,12 +23,6 @@ function run_test() { } function* testSymbols(client, debuggee) { - // Symbol is conditionally defined. If it isn't defined in this build, just pass. - if (typeof Symbol === "undefined") { - finishClient(client); - return; - } - const evalCode = () => { Components.utils.evalInSandbox( "(" + function () { From 372a8a591dfda8ffcd070a17e68953b4af8b4e56 Mon Sep 17 00:00:00 2001 From: David Keeler Date: Fri, 23 Jan 2015 14:04:44 -0800 Subject: [PATCH 006/115] bug 1123671 - if a non-overridable error is encountered when processing an overridable certificate error, report the non-overridable error r=mmc r=jcj Also, SEC_ERROR_UNTRUSTED_ISSUER and SEC_ERROR_UNTRUSTED_CERT are not actually overridable, so don't pretend they are. --- security/manager/ssl/src/NSSErrorsService.cpp | 23 ++++--- security/manager/ssl/src/NSSErrorsService.h | 1 + .../ssl/src/SSLServerCertVerification.cpp | 14 +++- .../ssl/tests/unit/test_cert_overrides.js | 61 +++++++++--------- .../manager/ssl/tests/unit/tlsserver/cert9.db | Bin 294912 -> 294912 bytes .../unit/tlsserver/cmd/BadCertServer.cpp | 1 + .../tests/unit/tlsserver/generate_certs.sh | 2 + .../manager/ssl/tests/unit/tlsserver/key4.db | Bin 458752 -> 458752 bytes 8 files changed, 60 insertions(+), 42 deletions(-) diff --git a/security/manager/ssl/src/NSSErrorsService.cpp b/security/manager/ssl/src/NSSErrorsService.cpp index 718492c5d89c..62ceec86c991 100644 --- a/security/manager/ssl/src/NSSErrorsService.cpp +++ b/security/manager/ssl/src/NSSErrorsService.cpp @@ -131,13 +131,23 @@ NSSErrorsService::GetErrorClass(nsresult aXPCOMErrorCode, uint32_t *aErrorClass) return NS_ERROR_FAILURE; } - switch (aNSPRCode) + if (mozilla::psm::ErrorIsOverridable(aNSPRCode)) { + *aErrorClass = ERROR_CLASS_BAD_CERT; + } else { + *aErrorClass = ERROR_CLASS_SSL_PROTOCOL; + } + + return NS_OK; +} + +bool +ErrorIsOverridable(PRErrorCode code) +{ + switch (code) { // Overridable errors. case SEC_ERROR_UNKNOWN_ISSUER: - case SEC_ERROR_UNTRUSTED_ISSUER: case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE: - case SEC_ERROR_UNTRUSTED_CERT: case SSL_ERROR_BAD_CERT_DOMAIN: case SEC_ERROR_EXPIRED_CERTIFICATE: case SEC_ERROR_CERT_SIGNATURE_ALGORITHM_DISABLED: @@ -146,14 +156,11 @@ NSSErrorsService::GetErrorClass(nsresult aXPCOMErrorCode, uint32_t *aErrorClass) case mozilla::pkix::MOZILLA_PKIX_ERROR_V1_CERT_USED_AS_CA: case mozilla::pkix::MOZILLA_PKIX_ERROR_NOT_YET_VALID_CERTIFICATE: case mozilla::pkix::MOZILLA_PKIX_ERROR_NOT_YET_VALID_ISSUER_CERTIFICATE: - *aErrorClass = ERROR_CLASS_BAD_CERT; - break; + return true; // Non-overridable errors. default: - *aErrorClass = ERROR_CLASS_SSL_PROTOCOL; - break; + return false; } - return NS_OK; } NS_IMETHODIMP diff --git a/security/manager/ssl/src/NSSErrorsService.h b/security/manager/ssl/src/NSSErrorsService.h index e1bd08d6e8dd..92fa2020ad17 100644 --- a/security/manager/ssl/src/NSSErrorsService.h +++ b/security/manager/ssl/src/NSSErrorsService.h @@ -38,6 +38,7 @@ private: bool IsNSSErrorCode(PRErrorCode code); nsresult GetXPCOMFromNSSError(PRErrorCode code); +bool ErrorIsOverridable(PRErrorCode code); } // psm } // mozilla diff --git a/security/manager/ssl/src/SSLServerCertVerification.cpp b/security/manager/ssl/src/SSLServerCertVerification.cpp index 18db66b75416..76f15ac79584 100644 --- a/security/manager/ssl/src/SSLServerCertVerification.cpp +++ b/security/manager/ssl/src/SSLServerCertVerification.cpp @@ -351,7 +351,10 @@ DetermineCertOverrideErrors(CERTCertificate* cert, const char* hostName, SECCertTimeValidity validity = CERT_CheckCertValidTimes(cert, now, false); if (validity == secCertTimeUndetermined) { - PR_SetError(defaultErrorCodeToReport, 0); + // This only happens if cert is null. CERT_CheckCertValidTimes will + // have set the error code to SEC_ERROR_INVALID_ARGS. We should really + // be using mozilla::pkix here anyway. + MOZ_ASSERT(PR_GetError() == SEC_ERROR_INVALID_ARGS); return SECFailure; } if (validity == secCertTimeExpired) { @@ -404,7 +407,7 @@ DetermineCertOverrideErrors(CERTCertificate* cert, const char* hostName, collectedErrors |= nsICertOverrideService::ERROR_MISMATCH; errorCodeMismatch = SSL_ERROR_BAD_CERT_DOMAIN; } else if (result != Success) { - PR_SetError(defaultErrorCodeToReport, 0); + PR_SetError(MapResultToPRErrorCode(result), 0); return SECFailure; } } @@ -593,6 +596,13 @@ CreateCertErrorRunnable(CertVerifier& certVerifier, defaultErrorCodeToReport, collected_errors, errorCodeTrust, errorCodeMismatch, errorCodeExpired) != SECSuccess) { + // Attempt to enforce that if DetermineCertOverrideErrors failed, + // PR_SetError was set with a non-overridable error. This is because if we + // return from CreateCertErrorRunnable without calling + // infoObject->SetStatusErrorBits, we won't have the required information + // to actually add a certificate error override. This results in a broken + // UI which is annoying but not a security disaster. + MOZ_ASSERT(!ErrorIsOverridable(PR_GetError())); return nullptr; } diff --git a/security/manager/ssl/tests/unit/test_cert_overrides.js b/security/manager/ssl/tests/unit/test_cert_overrides.js index c6d522115117..63634f8e2717 100644 --- a/security/manager/ssl/tests/unit/test_cert_overrides.js +++ b/security/manager/ssl/tests/unit/test_cert_overrides.js @@ -128,6 +128,22 @@ function add_simple_tests() { add_non_overridable_test("inadequatekeyusage.example.com", SEC_ERROR_INADEQUATE_KEY_USAGE); + // This is intended to test the case where a verification has failed for one + // overridable reason (e.g. unknown issuer) but then, in the process of + // reporting that error, a non-overridable error is encountered. The + // non-overridable error should be prioritized. + add_test(function() { + let rootCert = constructCertFromFile("tlsserver/test-ca.der"); + setCertTrust(rootCert, ",,"); + run_next_test(); + }); + add_non_overridable_test("badSubjectAltNames.example.com", SEC_ERROR_BAD_DER); + add_test(function() { + let rootCert = constructCertFromFile("tlsserver/test-ca.der"); + setCertTrust(rootCert, "CTu,,"); + run_next_test(); + }); + // Bug 990603: Apache documentation has recommended generating a self-signed // test certificate with basic constraints: CA:true. For compatibility, this // is a scenario in which an override is allowed. @@ -205,20 +221,18 @@ function add_distrust_tests() { // Before we specifically distrust this certificate, it should be trusted. add_connection_test("untrusted.example.com", Cr.NS_OK); - add_distrust_override_test("tlsserver/default-ee.der", - "untrusted.example.com", - getXPCOMStatusFromNSS(SEC_ERROR_UNTRUSTED_CERT)); + add_distrust_test("tlsserver/default-ee.der", "untrusted.example.com", + SEC_ERROR_UNTRUSTED_CERT); - add_distrust_override_test("tlsserver/other-test-ca.der", - "untrustedissuer.example.com", - getXPCOMStatusFromNSS(SEC_ERROR_UNTRUSTED_ISSUER)); + add_distrust_test("tlsserver/other-test-ca.der", + "untrustedissuer.example.com", SEC_ERROR_UNTRUSTED_ISSUER); - add_distrust_override_test("tlsserver/test-ca.der", - "ca-used-as-end-entity.example.com", - getXPCOMStatusFromNSS(SEC_ERROR_UNTRUSTED_ISSUER)); + add_distrust_test("tlsserver/test-ca.der", + "ca-used-as-end-entity.example.com", + SEC_ERROR_UNTRUSTED_ISSUER); } -function add_distrust_override_test(certFileName, hostName, expectedResult) { +function add_distrust_test(certFileName, hostName, expectedResult) { let certToDistrust = constructCertFromFile(certFileName); add_test(function () { @@ -227,26 +241,9 @@ function add_distrust_override_test(certFileName, hostName, expectedResult) { clearSessionCache(); run_next_test(); }); - add_connection_test(hostName, expectedResult, null, - function (securityInfo) { - securityInfo.QueryInterface(Ci.nsISSLStatusProvider); - // XXX(Bug 754369): SSLStatus isn't available for - // non-overridable errors. - if (securityInfo.SSLStatus) { - certOverrideService.rememberValidityOverride( - hostName, 8443, securityInfo.SSLStatus.serverCert, - Ci.nsICertOverrideService.ERROR_UNTRUSTED, true); - } else { - // A missing SSLStatus probably means (due to bug - // 754369) that the error was non-overridable, which - // is what we're trying to test, though we'd rather - // not test it this way. - do_check_neq(expectedResult, Cr.NS_OK); - } - clearSessionCache(); - }); - add_connection_test(hostName, expectedResult, null, - function () { - setCertTrust(certToDistrust, "u,,"); - }); + add_non_overridable_test(hostName, expectedResult); + add_test(function () { + setCertTrust(certToDistrust, "u,,"); + run_next_test(); + }); } diff --git a/security/manager/ssl/tests/unit/tlsserver/cert9.db b/security/manager/ssl/tests/unit/tlsserver/cert9.db index ef8a8c536ced0806f2d5012d63c6bdb96933ab64..ef60ef0f6074c057f7e4ef1c36e336fbb3ca6389 100644 GIT binary patch delta 1492 zcmZo@5Nc=;njp>id!mdp?6`G#Xz?i~P@}uP5_7e?^ zd?nN6zA{QOc7Q3~c2;HvCWbaJ*}5Gl^NfqRt+Ze&J5wkVkcwfFVJa<~TER4hrF3oS zlI?wc6p|8C6pBlevQm>v z9CJ$i5_40F8QM9Rg_xEyL@~6%7_Hm4l`{EpakNz`F;quYYH#OiU}9oqtMsXKu2h29 zwjF32Ba1OiM~67G0Ta;hU?R*8{mHbRjk&GNZYn!-C=-y1Vb)glI9EC4$+2$h(r){7 zNFnaF_)O)^z<8Kc#$43NY$JVhDmzOdhr(0&jWX+`Z-RUjDb3Ot*vK*6zJs}p1r(># zH*RN^_ejlRJQwU7jEotk|ESx?z1i8}q2aG%(C_G^4Gk&Z*}D0ovhNXtBT7f>Fi)W z_SEb7(KVJuJvN`e8+U`+H4#SQ|e(X6bGtSlru36C1k-Pq2-I>(3JM2+ggEkhP_HU13 z{t=cWc=^8KZK=~t%!~|-ixUju45WaGQdW>f*g&v}UrSGG`o>Ha$LSlcGAqEemHN?W?s?cVjxka%;}_MF(y^^Z1Ay{hwBc*CNZZr`Juq$gUk&krs>#F@i$@LA!8 z)l+;A>?-yD!e6*%_C}S6J!~BZE?>Xynf&knmp`-n3q3cO9qu%Ebn@!%*qVAKtts50 zm!(Ri?(eMH!04Y*c3v#+k?#wy@FkyST<~T5GQH4@Manrfi`cNmmNpri3>w*{U+iWs zuLnlBE-=EG7#TqM3kZM|RxOOcGy#+YB5KBy9T^dI8W>B!6bkeME5r}rA`HzB*s>SU z3ot*dnZoxdpsW9kQp^kqfu)-~lwOLftf`yo|DNIhwG*ztUR)>_;Jnpg%01<;$o=P& z(-#KWcS%;=41Iex=Z5`mapvvPQ!m`BnXLV!cMpGp-Jv#*lAc(%o_hsVHx^}zrn7TD zHhN&!V5aYTGeTwk1tF#%Ps5g{@<|wP?NDkgt&H|tsl^NN1299gfHU;=$x1A_u>ez- BGD`pe delta 212 zcmZo@5Nc=;njp>iexi&s?@stlM{&GI?^bHC2W(R7Y*+X<%Yvgech#RMNw;J@hBjdN$^!vPo0fnSq8d>rCxo yHraZFxvCUoMhwJ^>1E8hoy-NHnL2&?_e(5K3Rz+Hx>X@QcIlx diff --git a/security/manager/ssl/tests/unit/tlsserver/cmd/BadCertServer.cpp b/security/manager/ssl/tests/unit/tlsserver/cmd/BadCertServer.cpp index 470f16193152..273328f8435f 100644 --- a/security/manager/ssl/tests/unit/tlsserver/cmd/BadCertServer.cpp +++ b/security/manager/ssl/tests/unit/tlsserver/cmd/BadCertServer.cpp @@ -66,6 +66,7 @@ const BadCertHost sBadCertHosts[] = { "nsCertTypeCritical.example.com", "nsCertTypeCritical" }, { "end-entity-issued-by-v1-cert.example.com", "eeIssuedByV1Cert" }, { "inadequate-key-size-ee.example.com", "inadequateKeySizeEE" }, + { "badSubjectAltNames.example.com", "badSubjectAltNames" }, { nullptr, nullptr } }; diff --git a/security/manager/ssl/tests/unit/tlsserver/generate_certs.sh b/security/manager/ssl/tests/unit/tlsserver/generate_certs.sh index a12a16e5bf96..765c448c940d 100755 --- a/security/manager/ssl/tests/unit/tlsserver/generate_certs.sh +++ b/security/manager/ssl/tests/unit/tlsserver/generate_certs.sh @@ -330,4 +330,6 @@ make_EE eeIssuedByV1Cert 'CN=EE Issued by V1 Cert' v1Cert "localhost,*.example.c make_EE eeIssuedByIntermediate 'CN=EE issued by intermediate' testINT "localhost" export_cert eeIssuedByIntermediate test-int-ee.der +make_EE badSubjectAltNames 'CN=EE with bad subjectAltNames' testCA "*.*.example.com" + cleanup diff --git a/security/manager/ssl/tests/unit/tlsserver/key4.db b/security/manager/ssl/tests/unit/tlsserver/key4.db index 9df1ea37f30a1a7915bf85c9795dddfa3b0d993d..37f4e02d01df9b29f5ce8eeef54bb47b9d738401 100644 GIT binary patch delta 5390 zcmbW*2{@E(+XwJj?S`RH$(E5U8EdwTT~U@S$-aaVl6{*E*|Re#Yo!v&kWk9b$S$%} zWGP!A%HHD}Gkwp~*OQL#edlnPIsC7=e{-JqoY%|^hvUZKxDyWmmy) zCxih41^|&eza$6;wt+KXBnF>G3$lh_qA_^tA{7WLEtn0M53oS~xR|VQJC+Xq#ZyG#)TFDA=f65zHPe#RZlDCVRB|kfw^C zu!n?;Xm8Jm4K&$ZLGA>nG=kJUc%V;WL?f2!`E1^BW*jP$s0a%NP3~REUEOOyiii8WYifHTR8(n8BC{kS6^Mcht-WOfSfAR9M{WX^dvHmG{kOi^)DVKEs z!G6xMzXA?2Am*PJ{F=+!gP8u5%OOFGzst|tB6n_*Qc@s>pK|Qq75=>d38Lo#qbMD? z_Nbv7W^wGHyH5m+|k+T?*;+4|Cl3zfBn-y8FGVnd`IWM`!5Cj z{!jkz7zx~pB)@Yj;?pCMjpGl;YRubDZ(Uybs=X(PZ%(0y3{4Cnli z!oJTu+4ILu%MaKso&`^XfItX7N~h0!sfjVdH*A=x8|ak&nw#UxCf})M;z`E^8L7;f zXEV;+W6F;-b5g46YeF^=d!zO`3&DAZjjI)|t(tK$>R-R-HfL}XiLNXV_RPKnD;%|4 z^z9goRL)KC%{#(5zL7AslB#*A#365B9@^V;FSufuTW!)+SX4jL^wtoZCcmzAS!Ug@ zZFzvu6ARsIA8%2U_SIWJgHYR@DpWQhoDVWD-+7@Y4Du3_q*f&Rm!l)#=O2c-Yx&1> z_VRfhF6C(-e6xW2hVEZtjpXH3X`Xx@&=?Z?0BP)a?dJF&ZI7|H}R z;SbR*s}~dHg4KZDP!wRb>_pnJ#Oa(Y4bL1Mb{}G;AK0@679{3P?-Yb&>gCY%e7WD3 z*#Cmmq_^VYc)mtE>8ngIBaS4d5L`AtYZRwu6mC|8* z;}+BLF6Mpf1084If>Il=7Nv9*+6R_%3(Q^8l=qZH49Dd9TW&2LQ$r{TU9^Ez65+)k9VdZAlnU1rL zPFAup7AY=Iq`B*Lw6ZT1EjJkyE2`&niS#m(#_(I#cEWQi69dV5SNr5!SG*K+q!IW0 zr1X^|+!W?m;)JB&fYMg^klsPOhOLa&>22GS%pUvTzKw{~J+4L19Q8rweA8Kum8VXX z8WgIU6|B8EGOv9iMAkB|J3Vdtq&`cr^_Jrnl>rh(kNKru`2aB~Qhg#{>~D|ONuV%_ z#l%&pOAEqSe&PJmEmlB5A6nO_MHF3%vlWAXwibHJaUz=(DIk4#u+>96yFWi$Ry$&U zPHI+r&h4Ph!y8z^g3Ej7gjblT%vigHAxHWYN7JU&1H9c)^BBB`9fg?>y4%3b(l7RD zE1V`h>aycBY5A*~OzhMZy_`+g1i#J~^u>GXE_E94p#*GBDvs3#jg5UKw&z)fy&!(@ z8(cs*h;!CpJ~Hp8Fj&X4F)K5tmu_m0b7K(EaRB@^~?YH730?O*LX3j(w59cZXiu0iY4fd zI*3<`bBcM1wu=gh;EoI*kr9qRJbhSQD3gfCA@<`1!r@T0P&UB7zTpyjh!8QpTm0EP ziANFE3w|>~nqvr^09Ktx_2F9H{g2=}mAq5N1bi5TPcd|9lwV|z#Z$pY`wgFXg8dJC ziIsVwboM!ma^D&ET>3$>!n%u+TT51?J+HbyFUzO>7}%Sn68y=b{S{Yk>kK65n)+3r zqgDN~6h*-vnDJ%R-&fu{2h|2M-&g3x-322kK7P zR~p~d6Rb8OUndi`Jpw>m4L_hW1-=OW={+4vo_b+!)LMwKZEiE=KS;_4+(`~$` zvq19o39`cQTZM211Qq9dnS6D+#v*!g)rl?q%ZmV-kb|!Z0&DYp8`-yH8IiXwsHMo< z$QilMwxOZjGvOpxIf^rP>yVvID=p-C!n-J;Q9jE%mbV0xnELz~fg(JfbX2(*|OA z)~LoaRso|DL91gh*`WQcVGki2j;!A2JQQBv zF-2evcpeP&ADe3F44Lpw)b-hS6}tX0klL+7I(E9OAM%rME04k-_PD#aJN5P?;JzB2 z0GxZ*dLT-g+%1}4y7lAIin_HJS;?u5_dR$}T+7gc){VDqK(ji+%{=`kXP)W_dNTM^ z6-FktEU$A$0S4Cke5qx!d$i9GzoZO*%mj>?Yrd}XlOZe6U6h@zh4+)0FCps*e}$%< zN?_wO%<*o<#*VuwssZzHAcusC&FJ z(ApeZ-AW`QkX;buQ}T(w|I(jbL!v2g-i9@feJo-iDm31xLLhIjE@Y0jyoZmMTFM%K zy27=F&<;GyC*^(c+fC}#bkWP0(9&hRhlp1q$%?FicTp%?%l)>JBptV>(0J=}?*de- z-XZ(Fof;ZYz->w0O+a~{GgT@4^v!G874$IwQe2^AR|RQ4SC?dI8$j|hvz!*WE%%MA zfOb)KwidqS$Ne3A0#&aC3cVMOgLCtd$6X>-6q8TEVeFmKqLsN+<*zE6k^IiNWkF_h zg%7+aWk4kTrDdkRlPmh8K1jQRmShFEi$d93oz2MbL7}ulC zR%4T#LHC!~P?i3oucdl#1qD1^q)x?QK#f)mBdnxIy6>0v9Nk~^vQC+-0CrJ!_7+|z z6XlzUMPr(BhkDm1#KBdjz2R~$=kU!dM|c)SwigLR5)HqiBfWL0?W@B3h`{(tfie$$ z4@BEIW4I88U*K3c!mYjtFA#?P4MM)eC*Z@$C%>lzk*-zH_U_~8`cq}b7gwuiVPJC) z`D$DS(tU5}9Ew_sZ)W9Ca(nzcECTgiLXc=-i%vS=cSf_eEV()Q-bt4`WCgQ}LfKp9 zIL>>lxlbZD3Ktd%0~$c_eB4)49+g1&;|omgh_Gc+6nSr7(+p^z0d@nO+}?q0X!jr78>#EklJZUdO7DN4DyDjlkQ;WOC?`JM4&leARV z?GtVN%oEj$sa*_(YI`Iwa*c*ejFv4d8qPe`@1-Dosy?j^HsUns_`6JsuF~1CO%4A2 YPjlGA7v*kP!wTpXMD-5S2uAgI}=Dmw{H8yI;LWvDhwehz3OI$8lyV3I{TVmH4ODHYISN| z>)C6|YvZOWFw1PUV-~IkT4T1oxth75g`M%YV;@8Pm#um%Hq6_Lm{}66H!C!}U~2Dk xWZB;5$Xd3KSwyj5Dm$Ad&{hY35P9FdO From c11c432b2003940613513e9196ebd0484245323b Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Wed, 18 Feb 2015 09:28:53 +1100 Subject: [PATCH 007/115] Bug 1125391 - Re-enable bug 931668 optimizations. r=dbaron --- layout/base/RestyleManager.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index 9c7f34a562bb..c5de8e3d4023 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -3025,7 +3025,7 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf, RestyleResult result; - if (aRestyleHint || true /* XXX bug 1092363 */) { + if (aRestyleHint) { result = eRestyleResult_Continue; } else { result = ComputeRestyleResultFromFrame(aSelf); @@ -3316,9 +3316,7 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf, // previous continuation, so newContext == oldContext. if (result != eRestyleResult_Stop) { - if (true) { - // XXX bug 1092363 - } else if (copyFromContinuation) { + if (copyFromContinuation) { LOG_RESTYLE("not swapping style structs, since we copied from a " "continuation"); } else if (oldContext->IsShared() && newContext->IsShared()) { From e25c9358270bf3f17c7fa58c82f157a647cb9c0e Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Wed, 18 Feb 2015 09:28:53 +1100 Subject: [PATCH 008/115] Bug 1127198 - Part 1: Add a DEBUG-only count of frames that use a style context. r=dbaron --- layout/forms/nsButtonFrameRenderer.cpp | 40 ++++++++++++++++++++++++++ layout/forms/nsRangeFrame.cpp | 17 +++++++++++ layout/generic/nsFrame.cpp | 6 ++++ layout/generic/nsIFrame.h | 12 ++++++++ layout/style/nsStyleContext.cpp | 1 + layout/style/nsStyleContext.h | 17 +++++++++++ 6 files changed, 93 insertions(+) diff --git a/layout/forms/nsButtonFrameRenderer.cpp b/layout/forms/nsButtonFrameRenderer.cpp index 61950c3ebe85..b2f4d36c8d9b 100644 --- a/layout/forms/nsButtonFrameRenderer.cpp +++ b/layout/forms/nsButtonFrameRenderer.cpp @@ -29,6 +29,15 @@ nsButtonFrameRenderer::nsButtonFrameRenderer() nsButtonFrameRenderer::~nsButtonFrameRenderer() { MOZ_COUNT_DTOR(nsButtonFrameRenderer); + +#ifdef DEBUG + if (mInnerFocusStyle) { + mInnerFocusStyle->FrameRelease(); + } + if (mOuterFocusStyle) { + mOuterFocusStyle->FrameRelease(); + } +#endif } void @@ -390,6 +399,15 @@ nsButtonFrameRenderer::ReResolveStyles(nsPresContext* aPresContext) nsStyleContext* context = mFrame->StyleContext(); nsStyleSet *styleSet = aPresContext->StyleSet(); +#ifdef DEBUG + if (mInnerFocusStyle) { + mInnerFocusStyle->FrameRelease(); + } + if (mOuterFocusStyle) { + mOuterFocusStyle->FrameRelease(); + } +#endif + // style for the inner such as a dotted line (Windows) mInnerFocusStyle = styleSet->ProbePseudoElementStyle(mFrame->GetContent()->AsElement(), @@ -401,6 +419,15 @@ nsButtonFrameRenderer::ReResolveStyles(nsPresContext* aPresContext) styleSet->ProbePseudoElementStyle(mFrame->GetContent()->AsElement(), nsCSSPseudoElements::ePseudo_mozFocusOuter, context); + +#ifdef DEBUG + if (mInnerFocusStyle) { + mInnerFocusStyle->FrameAddRef(); + } + if (mOuterFocusStyle) { + mOuterFocusStyle->FrameAddRef(); + } +#endif } nsStyleContext* @@ -421,10 +448,23 @@ nsButtonFrameRenderer::SetStyleContext(int32_t aIndex, nsStyleContext* aStyleCon { switch (aIndex) { case NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX: +#ifdef DEBUG + if (mInnerFocusStyle) { + mInnerFocusStyle->FrameRelease(); + } +#endif mInnerFocusStyle = aStyleContext; break; case NS_BUTTON_RENDERER_FOCUS_OUTER_CONTEXT_INDEX: +#ifdef DEBUG + if (mOuterFocusStyle) { + mOuterFocusStyle->FrameRelease(); + } +#endif mOuterFocusStyle = aStyleContext; break; } +#ifdef DEBUG + aStyleContext->FrameAddRef(); +#endif } diff --git a/layout/forms/nsRangeFrame.cpp b/layout/forms/nsRangeFrame.cpp index d57e603628f7..ec5abb145031 100644 --- a/layout/forms/nsRangeFrame.cpp +++ b/layout/forms/nsRangeFrame.cpp @@ -50,6 +50,11 @@ nsRangeFrame::nsRangeFrame(nsStyleContext* aContext) nsRangeFrame::~nsRangeFrame() { +#ifdef DEBUG + if (mOuterFocusStyle) { + mOuterFocusStyle->FrameRelease(); + } +#endif } NS_IMPL_FRAMEARENA_HELPERS(nsRangeFrame) @@ -880,6 +885,18 @@ nsRangeFrame::SetAdditionalStyleContext(int32_t aIndex, MOZ_ASSERT(aIndex == 0, "GetAdditionalStyleContext is handling other indexes?"); +#ifdef DEBUG + if (mOuterFocusStyle) { + mOuterFocusStyle->FrameRelease(); + } +#endif + // The -moz-focus-outer pseudo-element's style has changed. mOuterFocusStyle = aStyleContext; + +#ifdef DEBUG + if (mOuterFocusStyle) { + mOuterFocusStyle->FrameAddRef(); + } +#endif } diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 02fdc073edba..e4c11b15489d 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -404,6 +404,9 @@ nsFrame::nsFrame(nsStyleContext* aContext) mState = NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY; mStyleContext = aContext; mStyleContext->AddRef(); +#ifdef DEBUG + mStyleContext->FrameAddRef(); +#endif } nsFrame::~nsFrame() @@ -411,6 +414,9 @@ nsFrame::~nsFrame() MOZ_COUNT_DTOR(nsFrame); NS_IF_RELEASE(mContent); +#ifdef DEBUG + mStyleContext->FrameRelease(); +#endif mStyleContext->Release(); } diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index b7b64bd97fbc..7a94bd49cab3 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -538,7 +538,13 @@ public: nsStyleContext* oldStyleContext = mStyleContext; mStyleContext = aContext; aContext->AddRef(); +#ifdef DEBUG + aContext->FrameAddRef(); +#endif DidSetStyleContext(oldStyleContext); +#ifdef DEBUG + oldStyleContext->FrameRelease(); +#endif oldStyleContext->Release(); } } @@ -552,9 +558,15 @@ public: void SetStyleContextWithoutNotification(nsStyleContext* aContext) { if (aContext != mStyleContext) { +#ifdef DEBUG + mStyleContext->FrameRelease(); +#endif mStyleContext->Release(); mStyleContext = aContext; aContext->AddRef(); +#ifdef DEBUG + aContext->FrameAddRef(); +#endif } } diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index ba767028c947..782f798837bb 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -76,6 +76,7 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent, , mBits(((uint64_t)aPseudoType) << NS_STYLE_CONTEXT_TYPE_SHIFT) , mRefCnt(0) #ifdef DEBUG + , mFrameRefCnt(0) , mComputingStruct(nsStyleStructID_None) #endif { diff --git a/layout/style/nsStyleContext.h b/layout/style/nsStyleContext.h index c4668c527332..ad22efa42af3 100644 --- a/layout/style/nsStyleContext.h +++ b/layout/style/nsStyleContext.h @@ -97,6 +97,20 @@ public: return mRefCnt; } +#ifdef DEBUG + void FrameAddRef() { + ++mFrameRefCnt; + } + + void FrameRelease() { + --mFrameRefCnt; + } + + uint32_t FrameRefCnt() const { + return mFrameRefCnt; + } +#endif + bool HasSingleReference() const { NS_ASSERTION(mRefCnt != 0, "do not call HasSingleReference on a newly created " @@ -551,6 +565,9 @@ private: uint32_t mRefCnt; #ifdef DEBUG + uint32_t mFrameRefCnt; // number of frames that use this + // as their style context + nsStyleStructID mComputingStruct; static bool DependencyAllowed(nsStyleStructID aOuterSID, From a61236bccde422dd5eba0a98289fbaf6eebc1991 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Wed, 18 Feb 2015 09:28:53 +1100 Subject: [PATCH 009/115] Bug 1127198 - Part 2: Assert if we clear cached structs on a style context still used by a frame. r=dbaron --- layout/reftests/printing/reftest.list | 2 +- layout/style/nsStyleContext.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/layout/reftests/printing/reftest.list b/layout/reftests/printing/reftest.list index 643fbbec5efc..267fab7d764b 100644 --- a/layout/reftests/printing/reftest.list +++ b/layout/reftests/printing/reftest.list @@ -32,4 +32,4 @@ skip-if(B2G) fuzzy-if(cocoaWidget,1,5000) == 745025-1.html 745025-1-ref.html # r random-if(B2G&&browserIsRemote) == 960822.html 960822-ref.html # reftest-print doesn't work on B2G (scrollbar difference only) == 966419-1.html 966419-1-ref.html == 966419-2.html 966419-2-ref.html -skip-if(B2G) asserts(2) HTTP(..) == 1108104.html 1108104-ref.html # bug 1067755 +skip-if(B2G) asserts(3) HTTP(..) == 1108104.html 1108104-ref.html # bug 1067755 diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index 782f798837bb..08c74127bdc4 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -1245,6 +1245,7 @@ nsStyleContext::ClearCachedInheritedStyleDataOnDescendants(uint32_t aStructs) void nsStyleContext::DoClearCachedInheritedStyleDataOnDescendants(uint32_t aStructs) { + NS_ASSERTION(mFrameRefCnt == 0, "frame still referencing style context"); for (nsStyleStructID i = nsStyleStructID_Inherited_Start; i < nsStyleStructID_Inherited_Start + nsStyleStructID_Inherited_Count; i = nsStyleStructID(i + 1)) { From b561d4e5ae81b937ee778e73844f1e065b9b3190 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Wed, 18 Feb 2015 09:28:53 +1100 Subject: [PATCH 010/115] Bug 1127198 - Part 3: Crashtest. r=dbaron --- layout/base/crashtests/1127198-1.html | 5 +++++ layout/base/crashtests/crashtests.list | 1 + 2 files changed, 6 insertions(+) create mode 100644 layout/base/crashtests/1127198-1.html diff --git a/layout/base/crashtests/1127198-1.html b/layout/base/crashtests/1127198-1.html new file mode 100644 index 000000000000..8f1524050d49 --- /dev/null +++ b/layout/base/crashtests/1127198-1.html @@ -0,0 +1,5 @@ +a
b
diff --git a/layout/base/crashtests/crashtests.list b/layout/base/crashtests/crashtests.list index efc44a654128..4f440406b153 100644 --- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -456,3 +456,4 @@ load 1043163-1.html load 1061028.html load 1116104.html load 1107508-1.html +load 1127198-1.html From 635933d3f87fa2b076eace741e4df207c41f6043 Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Wed, 18 Feb 2015 09:28:53 +1100 Subject: [PATCH 011/115] Bug 1127198 - Part 4: Clear cached structs only after we have fully processed a restyle. r=dbaron --- layout/base/RestyleManager.cpp | 125 +++++++++++++++++++++++++++------ layout/base/RestyleManager.h | 26 ++++++- 2 files changed, 125 insertions(+), 26 deletions(-) diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index c5de8e3d4023..372765b9e073 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -2435,7 +2435,10 @@ ElementRestyler::ElementRestyler(nsPresContext* aPresContext, RestyleTracker& aRestyleTracker, TreeMatchContext& aTreeMatchContext, nsTArray& - aVisibleKidsOfHiddenElement) + aVisibleKidsOfHiddenElement, + nsTArray& aContextsToClear, + nsTArray>& + aSwappedStructOwners) : mPresContext(aPresContext) , mFrame(aFrame) , mParentContent(nullptr) @@ -2450,6 +2453,8 @@ ElementRestyler::ElementRestyler(nsPresContext* aPresContext, , mRestyleTracker(aRestyleTracker) , mTreeMatchContext(aTreeMatchContext) , mResolvedChild(nullptr) + , mContextsToClear(aContextsToClear) + , mSwappedStructOwners(aSwappedStructOwners) #ifdef ACCESSIBILITY , mDesiredA11yNotifications(eSendAllNotifications) , mKidsDesiredA11yNotifications(mDesiredA11yNotifications) @@ -2480,6 +2485,8 @@ ElementRestyler::ElementRestyler(const ElementRestyler& aParentRestyler, , mRestyleTracker(aParentRestyler.mRestyleTracker) , mTreeMatchContext(aParentRestyler.mTreeMatchContext) , mResolvedChild(nullptr) + , mContextsToClear(aParentRestyler.mContextsToClear) + , mSwappedStructOwners(aParentRestyler.mSwappedStructOwners) #ifdef ACCESSIBILITY , mDesiredA11yNotifications(aParentRestyler.mKidsDesiredA11yNotifications) , mKidsDesiredA11yNotifications(mDesiredA11yNotifications) @@ -2524,6 +2531,8 @@ ElementRestyler::ElementRestyler(ParentContextFromChildFrame, , mRestyleTracker(aParentRestyler.mRestyleTracker) , mTreeMatchContext(aParentRestyler.mTreeMatchContext) , mResolvedChild(nullptr) + , mContextsToClear(aParentRestyler.mContextsToClear) + , mSwappedStructOwners(aParentRestyler.mSwappedStructOwners) #ifdef ACCESSIBILITY , mDesiredA11yNotifications(aParentRestyler.mDesiredA11yNotifications) , mKidsDesiredA11yNotifications(mDesiredA11yNotifications) @@ -2543,7 +2552,10 @@ ElementRestyler::ElementRestyler(nsPresContext* aPresContext, RestyleTracker& aRestyleTracker, TreeMatchContext& aTreeMatchContext, nsTArray& - aVisibleKidsOfHiddenElement) + aVisibleKidsOfHiddenElement, + nsTArray& aContextsToClear, + nsTArray>& + aSwappedStructOwners) : mPresContext(aPresContext) , mFrame(nullptr) , mParentContent(nullptr) @@ -2556,6 +2568,8 @@ ElementRestyler::ElementRestyler(nsPresContext* aPresContext, , mRestyleTracker(aRestyleTracker) , mTreeMatchContext(aTreeMatchContext) , mResolvedChild(nullptr) + , mContextsToClear(aContextsToClear) + , mSwappedStructOwners(aSwappedStructOwners) #ifdef ACCESSIBILITY , mDesiredA11yNotifications(eSendAllNotifications) , mKidsDesiredA11yNotifications(mDesiredA11yNotifications) @@ -2804,6 +2818,19 @@ ElementRestyler::Restyle(nsRestyleHint aRestyleHint) // this old style context to point to its new parent. LOG_RESTYLE("moving style context %p from old parent %p to new parent %p", oldContext.get(), oldContext->GetParent(), newParent); + // We keep strong references to the new parent around until the end + // of the restyle, in case: + // (a) we swapped structs between the old and new parent, + // (b) some descendants of the old parent are not getting restyled + // (which is the reason for the existence of + // ClearCachedInheritedStyleDataOnDescendants), + // (d) something under ProcessPendingRestyles (which notably is called + // *before* ClearCachedInheritedStyleDataOnDescendants is called + // on the old context) causes the new parent to be destroyed, thus + // destroying its owned structs, and + // (c) something under ProcessPendingRestyles then wants to use of those + // now destroyed structs (through the old parent's descendants). + mSwappedStructOwners.AppendElement(newParent); oldContext->MoveTo(newParent); } @@ -2842,17 +2869,29 @@ ElementRestyler::Restyle(nsRestyleHint aRestyleHint) if (oldContext && !oldContext->HasSingleReference()) { // If we swapped some structs out of oldContext in the RestyleSelf call // and after the RestyleChildren call we still have other strong references - // to it, we need to make ensure its descendants don't cached any of the + // to it, we need to make ensure its descendants don't cache any of the // structs that were swapped out. // - // Most of the time we will not get in here; we do for example when the - // style context is being held on to by an nsComputedDOMStyle object. + // Much of the time we will not get in here; we do for example when the + // style context is shared with a later IB split sibling (which we won't + // restyle until a bit later) or if other code is holding a strong reference + // to the style context (as is done by nsTransformedTextRun objects, which + // can be referenced by a text frame's mTextRun longer than the frame's + // mStyleContext). // - // Strictly we only have to do this if we have a child whose old or new - // style context is shared (as in that case we would not have swapped that - // child's structs and it would have kept its now out of date cached - // structs). For now we don't bother tracking that. - oldContext->ClearCachedInheritedStyleDataOnDescendants(swappedStructs); + // We coalesce entries in mContextsToClear when we detect that the last + // style context appended has oldContext as its parent, as + // ClearCachedInheritedStyleDataOnDescendants handles a whole subtree + // of style contexts. + if (!mContextsToClear.IsEmpty() && + mContextsToClear.LastElement().mStyleContext->GetParent() == oldContext && + mContextsToClear.LastElement().mStructs == swappedStructs) { + mContextsToClear.LastElement().mStyleContext = Move(oldContext); + } else { + ContextToClear* toClear = mContextsToClear.AppendElement(); + toClear->mStyleContext = Move(oldContext); + toClear->mStructs = swappedStructs; + } } mRestyleTracker.AddRestyleRootsIfAwaitingRestyle(descendants); @@ -3531,7 +3570,8 @@ ElementRestyler::RestyleChildrenOfDisplayContentsElement( !f->GetPrevContinuation()) { if (!(f->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { ComputeStyleChangeFor(f, mChangeList, aMinHint, aRestyleTracker, - aRestyleHint); + aRestyleHint, mContextsToClear, + mSwappedStructOwners); } } } @@ -3547,7 +3587,11 @@ ElementRestyler::ComputeStyleChangeFor(nsIFrame* aFrame, nsStyleChangeList* aChangeList, nsChangeHint aMinChange, RestyleTracker& aRestyleTracker, - nsRestyleHint aRestyleHint) + nsRestyleHint aRestyleHint, + nsTArray& + aContextsToClear, + nsTArray>& + aSwappedStructOwners) { PROFILER_LABEL("ElementRestyler", "ComputeStyleChangeFor", js::ProfileEntry::Category::CSS); @@ -3595,7 +3639,8 @@ ElementRestyler::ComputeStyleChangeFor(nsIFrame* aFrame, ElementRestyler restyler(presContext, cont, aChangeList, aMinChange, aRestyleTracker, treeMatchContext, - visibleKidsOfHiddenElement); + visibleKidsOfHiddenElement, + aContextsToClear, aSwappedStructOwners); restyler.Restyle(aRestyleHint); @@ -3970,6 +4015,20 @@ ElementRestyler::SendAccessibilityNotifications() #endif } +static void +ClearCachedInheritedStyleDataOnDescendants( + nsTArray& aContextsToClear) +{ + for (size_t i = 0; i < aContextsToClear.Length(); i++) { + auto& entry = aContextsToClear[i]; + if (!entry.mStyleContext->HasSingleReference()) { + entry.mStyleContext->ClearCachedInheritedStyleDataOnDescendants( + entry.mStructs); + } + entry.mStyleContext = nullptr; + } +} + void RestyleManager::ComputeAndProcessStyleChange(nsIFrame* aFrame, nsChangeHint aMinChange, @@ -3978,9 +4037,19 @@ RestyleManager::ComputeAndProcessStyleChange(nsIFrame* aFrame, { MOZ_ASSERT(mReframingStyleContexts, "should have rsc"); nsStyleChangeList changeList; - ElementRestyler::ComputeStyleChangeFor(aFrame, &changeList, aMinChange, - aRestyleTracker, aRestyleHint); - ProcessRestyledFrames(changeList); + nsTArray contextsToClear; + { + // swappedStructOwners needs to be kept alive until after + // ProcessRestyledFrames; see comment in ElementRestyler::Restyle. + // (Destroying it before the ClearCachedInheritedStyleDataOnDescendants call + // helps minimize the work done by that function.) + nsTArray> swappedStructOwners; + ElementRestyler::ComputeStyleChangeFor(aFrame, &changeList, aMinChange, + aRestyleTracker, aRestyleHint, + contextsToClear, swappedStructOwners); + ProcessRestyledFrames(changeList); + } + ClearCachedInheritedStyleDataOnDescendants(contextsToClear); } void @@ -4003,13 +4072,23 @@ RestyleManager::ComputeAndProcessStyleChange(nsStyleContext* aNewContext, parent && parent->IsElement() ? parent->AsElement() : nullptr; treeMatchContext.InitAncestors(parentElement); nsTArray visibleKidsOfHiddenElement; - nsStyleChangeList changeList; - ElementRestyler r(frame->PresContext(), aElement, &changeList, aMinChange, - aRestyleTracker, treeMatchContext, - visibleKidsOfHiddenElement); - r.RestyleChildrenOfDisplayContentsElement(frame, aNewContext, aMinChange, - aRestyleTracker, aRestyleHint); - ProcessRestyledFrames(changeList); + nsTArray contextsToClear; + { + // swappedStructOwners needs to be kept alive until after + // ProcessRestyledFrames; see comment in ElementRestyler::Restyle. + // (Destroying it before the ClearCachedInheritedStyleDataOnDescendants call + // helps minimize the work done by that function.) + nsTArray> swappedStructOwners; + nsStyleChangeList changeList; + ElementRestyler r(frame->PresContext(), aElement, &changeList, aMinChange, + aRestyleTracker, treeMatchContext, + visibleKidsOfHiddenElement, contextsToClear, + swappedStructOwners); + r.RestyleChildrenOfDisplayContentsElement(frame, aNewContext, aMinChange, + aRestyleTracker, aRestyleHint); + ProcessRestyledFrames(changeList); + } + ClearCachedInheritedStyleDataOnDescendants(contextsToClear); } AutoDisplayContentsAncestorPusher::AutoDisplayContentsAncestorPusher( diff --git a/layout/base/RestyleManager.h b/layout/base/RestyleManager.h index 635033c47856..f93419f467de 100644 --- a/layout/base/RestyleManager.h +++ b/layout/base/RestyleManager.h @@ -499,6 +499,11 @@ class ElementRestyler MOZ_FINAL public: typedef mozilla::dom::Element Element; + struct ContextToClear { + nsRefPtr mStyleContext; + uint32_t mStructs; + }; + // Construct for the root of the subtree that we're restyling. ElementRestyler(nsPresContext* aPresContext, nsIFrame* aFrame, @@ -506,7 +511,9 @@ public: nsChangeHint aHintsHandledByAncestors, RestyleTracker& aRestyleTracker, TreeMatchContext& aTreeMatchContext, - nsTArray& aVisibleKidsOfHiddenElement); + nsTArray& aVisibleKidsOfHiddenElement, + nsTArray& aContextsToClear, + nsTArray>& aSwappedStructOwners); // Construct for an element whose parent is being restyled. enum ConstructorFlags { @@ -534,7 +541,9 @@ public: nsChangeHint aHintsHandledByAncestors, RestyleTracker& aRestyleTracker, TreeMatchContext& aTreeMatchContext, - nsTArray& aVisibleKidsOfHiddenElement); + nsTArray& aVisibleKidsOfHiddenElement, + nsTArray& aContextsToClear, + nsTArray>& aSwappedStructOwners); /** * Restyle our frame's element and its subtree. @@ -574,7 +583,10 @@ public: nsStyleChangeList* aChangeList, nsChangeHint aMinChange, RestyleTracker& aRestyleTracker, - nsRestyleHint aRestyleHint); + nsRestyleHint aRestyleHint, + nsTArray& aContextsToClear, + nsTArray>& + aSwappedStructOwners); #ifdef RESTYLE_LOGGING bool ShouldLogRestyle() { @@ -703,6 +715,14 @@ private: RestyleTracker& mRestyleTracker; TreeMatchContext& mTreeMatchContext; nsIFrame* mResolvedChild; // child that provides our parent style context + // Array of style context subtrees in which we need to clear out cached + // structs at the end of the restyle (after change hints have been + // processed). + nsTArray& mContextsToClear; + // Style contexts that had old structs swapped into it and which should + // stay alive until the end of the restyle. (See comment in + // ElementRestyler::Restyle.) + nsTArray>& mSwappedStructOwners; #ifdef ACCESSIBILITY const DesiredA11yNotifications mDesiredA11yNotifications; From 80b4e231335bfa4a804f5e7045384031d3a1956a Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Tue, 17 Feb 2015 22:34:25 +0000 Subject: [PATCH 012/115] Bug 1082017 - Add writing-mode to prerequisites for line-height and font (shorthand) tests, because vertical vs horizontal mode may result in different line metrics. r=dbaron --- layout/style/test/property_database.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index ae3df974dd44..f79f71b3934e 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -5255,6 +5255,19 @@ if (SpecialPowers.getBoolPref("layout.css.vertical-text.enabled")) { for (var prop in verticalTextProperties) { gCSSProperties[prop] = verticalTextProperties[prop]; } + /* + * Vertical vs horizontal writing-mode can affect line-height + * because font metrics may not be symmetrical, + * so we require writing-mode:initial to ensure consistency + * in font shorthand and line-height tests. + */ + ["font", "line-height"].forEach(function(prop) { + var p = gCSSProperties[prop]; + if (p.prerequisites === undefined) { + p.prerequisites = {}; + } + p.prerequisites["writing-mode"] = "initial"; + }); } if (SpecialPowers.getBoolPref("layout.css.masking.enabled")) { From 2a815dd08c3b4ba58ea5cdef1b78e2f07bb1f86c Mon Sep 17 00:00:00 2001 From: Barbara Miller Date: Tue, 17 Feb 2015 23:04:27 +0000 Subject: [PATCH 013/115] Bug 1131219 - Add focusmanager.testmode to Marionette; r=dburns --- testing/marionette/client/marionette/geckoinstance.py | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/marionette/client/marionette/geckoinstance.py b/testing/marionette/client/marionette/geckoinstance.py index e289b13ba6a3..a9991777964a 100644 --- a/testing/marionette/client/marionette/geckoinstance.py +++ b/testing/marionette/client/marionette/geckoinstance.py @@ -29,6 +29,7 @@ class GeckoInstance(object): "browser.tabs.remote.autostart.2": False, "browser.warnOnQuit": False, "dom.ipc.reportProcessHangs": False, + "focusmanager.testmode": True, "startup.homepage_welcome_url": "about:blank"} def __init__(self, host, port, bin, profile=None, app_args=None, symbols_path=None, From f3c61cd8232a4636078d179e54992b340317b5bb Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Tue, 17 Feb 2015 12:44:00 -0800 Subject: [PATCH 014/115] Bug 1127448 - Append the build id to the ua string for youtube. r=mconley We want to be able to distinguish different builds to track down crashes and other problems with the YouTube site. Pushing the build id lets google group statistics from their logging in the same bins for comparison. Limited by #ifdef MOZ_UPDATE_CHANNEL to beta, aurora, and nightly. Limited by media.mediasource.enabled pref. We put this in nsBrowserGlue.js instead of browser.js so it runs once, rather than once per window like the fennec implementation we copied. They only ever have one window, so it's ok there. --HG-- extra : rebase_source : f933523c24391adc50090dc17e06d4cf37655f5c --- browser/components/nsBrowserGlue.js | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index a75d1485b4d5..1eb868bcf6fa 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -119,6 +119,13 @@ XPCOMUtils.defineLazyModuleGetter(this, "UpdateChannel", "resource://gre/modules/UpdateChannel.jsm"); #endif + +#if defined(MOZ_UPDATE_CHANNEL) && MOZ_UPDATE_CHANNEL != release +#define MOZ_DEBUG_UA // Shorthand define for subsequent conditional sections. +XPCOMUtils.defineLazyModuleGetter(this, "UserAgentOverrides", + "resource://gre/modules/UserAgentOverrides.jsm"); +#endif + XPCOMUtils.defineLazyGetter(this, "ShellService", function() { try { return Cc["@mozilla.org/browser/shell-service;1"]. @@ -684,6 +691,11 @@ BrowserGlue.prototype = { Services.prefs.addObserver(POLARIS_ENABLED, this, false); #endif +#ifdef MOZ_DEBUG_UA + UserAgentOverrides.init(); + DebugUserAgent.init(); +#endif + Services.obs.notifyObservers(null, "browser-ui-startup-complete", ""); AddonWatcher.init(this._notifySlowAddon); @@ -917,6 +929,9 @@ BrowserGlue.prototype = { if (Services.prefs.getBoolPref("dom.identity.enabled")) { SignInToWebsiteUX.uninit(); } +#endif +#ifdef MOZ_DEBUG_UA + UserAgentOverrides.uninit(); #endif webrtcUI.uninit(); FormValidationHandler.uninit(); @@ -2835,3 +2850,36 @@ let globalMM = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessag globalMM.addMessageListener("UITour:onPageEvent", function(aMessage) { UITour.onPageEvent(aMessage, aMessage.data); }); + +#ifdef MOZ_DEBUG_UA +// Modify the user agent string for specific domains +// to route debug information through their logging. +var DebugUserAgent = { + DEBUG_UA: null, + DOMAINS: [ + 'youtube.com', + 'www.youtube.com', + 'youtube-nocookie.com', + 'www.youtube-nocookie.com', + ], + + init: function() { + // Only run if the MediaSource Extension API is available. + if (!Services.prefs.getBoolPref("media.mediasource.enabled")) { + return; + } + // Install our override filter. + UserAgentOverrides.addComplexOverride(this.onRequest.bind(this)); + let ua = Cc["@mozilla.org/network/protocol;1?name=http"] + .getService(Ci.nsIHttpProtocolHandler).userAgent; + this.DEBUG_UA = ua + " Build/" + Services.appinfo.appBuildID; + }, + + onRequest: function(channel, defaultUA) { + if (this.DOMAINS.includes(channel.URI.host)) { + return this.DEBUG_UA; + } + return null; + }, +}; +#endif // MOZ_DEBUG_UA From 41261ade80fdf2b2649ad85c2d41e349af55535c Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Tue, 17 Feb 2015 15:08:53 -0800 Subject: [PATCH 015/115] Bug 1131424 - Report error message when failing to open ctypes library, r=jorendorff --- js/src/ctypes/Library.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/src/ctypes/Library.cpp b/js/src/ctypes/Library.cpp index 80fa6fb95dc6..fde418bc5397 100644 --- a/js/src/ctypes/Library.cpp +++ b/js/src/ctypes/Library.cpp @@ -6,6 +6,7 @@ #include "ctypes/Library.h" +#include "prerror.h" #include "prlink.h" #include "ctypes/CTypes.h" @@ -146,12 +147,17 @@ Library::Create(JSContext* cx, jsval path_, const JSCTypesCallbacks* callbacks) PRLibrary* library = PR_LoadLibraryWithFlags(libSpec, 0); if (!library) { + char *error = (char*) JS_malloc(PR_GetErrorTextLength() + 1); + if (error) + PR_GetErrorText(error); + #ifdef XP_WIN - JS_ReportError(cx, "couldn't open library %hs", pathChars); + JS_ReportError(cx, "couldn't open library %hs: %s", pathChars, error); #else - JS_ReportError(cx, "couldn't open library %s", pathBytes); + JS_ReportError(cx, "couldn't open library %s: %s", pathBytes, error); JS_free(cx, pathBytes); #endif + JS_free(cx, error); return nullptr; } From 7899e2d39fe46176d52e063894ea599f37e67e7a Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Tue, 17 Feb 2015 15:09:30 -0800 Subject: [PATCH 016/115] Bug 1131380 - Run all shell builds with ASLR off, r=terrence --- js/src/devtools/automation/autospider.sh | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/js/src/devtools/automation/autospider.sh b/js/src/devtools/automation/autospider.sh index 7b700ff60b19..67bbac417e95 100755 --- a/js/src/devtools/automation/autospider.sh +++ b/js/src/devtools/automation/autospider.sh @@ -111,29 +111,22 @@ $SOURCE/js/src/configure $CONFIGURE_ARGS --enable-nspr-build --prefix=$OBJDIR/di $MAKE -s -w -j4 || exit 2 cp -p $SOURCE/build/unix/run-mozilla.sh $OBJDIR/dist/bin -# The root analysis tests run in a special GC Zeal mode and disable ASLR to -# make tests reproducible. COMMAND_PREFIX='' + +# On Linux, disable ASLR to make shell builds a bit more reproducible. +if type setarch >/dev/null 2>&1; then + COMMAND_PREFIX="setarch $(uname -m) -R " +fi + if [[ "$VARIANT" = "rootanalysis" ]]; then export JS_GC_ZEAL=7 - # rootanalysis builds are currently only done on Linux, which should have - # setarch, but just in case we enable them on another platform: - if type setarch >/dev/null 2>&1; then - COMMAND_PREFIX="setarch $(uname -m) -R " - fi elif [[ "$VARIANT" = "generational" ]]; then # Generational is currently being used for compacting GC export JS_GC_ZEAL=14 # Ignore timeouts from tests that are known to take too long with this zeal mode export JITTEST_EXTRA_ARGS=--ignore-timeouts=$ABSDIR/cgc-jittest-timeouts.txt - - # rootanalysis builds are currently only done on Linux, which should have - # setarch, but just in case we enable them on another platform: - if type setarch >/dev/null 2>&1; then - COMMAND_PREFIX="setarch $(uname -m) -R " - fi fi $COMMAND_PREFIX $MAKE check || exit 1 From 1bb3ccff838ed2afa8751e19cf81c6b237050910 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Tue, 17 Feb 2015 15:27:02 -0800 Subject: [PATCH 017/115] Bugfix followup to bug 1131424 on a CLOSED TREE --HG-- extra : amend_source : 5437fb0008e51c3fa2746c614cf28464c635cfe5 --- js/src/ctypes/Library.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/ctypes/Library.cpp b/js/src/ctypes/Library.cpp index fde418bc5397..270e41216357 100644 --- a/js/src/ctypes/Library.cpp +++ b/js/src/ctypes/Library.cpp @@ -147,7 +147,7 @@ Library::Create(JSContext* cx, jsval path_, const JSCTypesCallbacks* callbacks) PRLibrary* library = PR_LoadLibraryWithFlags(libSpec, 0); if (!library) { - char *error = (char*) JS_malloc(PR_GetErrorTextLength() + 1); + char *error = (char*) JS_malloc(cx, PR_GetErrorTextLength() + 1); if (error) PR_GetErrorText(error); From 5cc04bad46c2311b1c2b77558710dbe9fc139b6a Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Tue, 17 Feb 2015 15:38:38 -0800 Subject: [PATCH 018/115] Backed out 2 changesets (bug 1131424) for continuing problems on a CLOSED TREE Backed out changeset c43187545daa (bug 1131424) Backed out changeset 0e7e4e9718b7 (bug 1131424) --- js/src/ctypes/Library.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/js/src/ctypes/Library.cpp b/js/src/ctypes/Library.cpp index 270e41216357..80fa6fb95dc6 100644 --- a/js/src/ctypes/Library.cpp +++ b/js/src/ctypes/Library.cpp @@ -6,7 +6,6 @@ #include "ctypes/Library.h" -#include "prerror.h" #include "prlink.h" #include "ctypes/CTypes.h" @@ -147,17 +146,12 @@ Library::Create(JSContext* cx, jsval path_, const JSCTypesCallbacks* callbacks) PRLibrary* library = PR_LoadLibraryWithFlags(libSpec, 0); if (!library) { - char *error = (char*) JS_malloc(cx, PR_GetErrorTextLength() + 1); - if (error) - PR_GetErrorText(error); - #ifdef XP_WIN - JS_ReportError(cx, "couldn't open library %hs: %s", pathChars, error); + JS_ReportError(cx, "couldn't open library %hs", pathChars); #else - JS_ReportError(cx, "couldn't open library %s: %s", pathBytes, error); + JS_ReportError(cx, "couldn't open library %s", pathBytes); JS_free(cx, pathBytes); #endif - JS_free(cx, error); return nullptr; } From 5ea802bd9a5ac6218fafff9f3dd1c1a41183b919 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Wed, 18 Feb 2015 13:35:30 +1300 Subject: [PATCH 019/115] Bug 1128170 - Use UniquePtr for TextureClient KeepAlive objects to make sure we don't leak them. r=jrmuizel --- gfx/layers/client/TextureClient.cpp | 9 ++++----- gfx/layers/client/TextureClient.h | 2 +- gfx/layers/d3d11/TextureD3D11.cpp | 4 ++-- gfx/layers/d3d9/TextureD3D9.cpp | 2 +- gfx/layers/d3d9/TextureD3D9.h | 4 +++- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 59348da94af9..fee69052f4aa 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -86,7 +86,6 @@ public: TextureChild() : mForwarder(nullptr) , mTextureClient(nullptr) - , mKeep(nullptr) , mIPCOpen(false) { } @@ -135,7 +134,7 @@ private: RefPtr mForwarder; RefPtr mWaitForRecycle; TextureClient* mTextureClient; - KeepAlive* mKeep; + UniquePtr mKeep; bool mIPCOpen; friend class TextureClient; @@ -154,7 +153,7 @@ TextureChild::ActorDestroy(ActorDestroyReason why) mTextureClient->mActor = nullptr; } mWaitForRecycle = nullptr; - delete mKeep; + mKeep = nullptr; } // static @@ -496,11 +495,11 @@ TextureClient::~TextureClient() } void -TextureClient::KeepUntilFullDeallocation(KeepAlive* aKeep) +TextureClient::KeepUntilFullDeallocation(UniquePtr aKeep) { MOZ_ASSERT(mActor); MOZ_ASSERT(!mActor->mKeep); - mActor->mKeep = aKeep; + mActor->mKeep = Move(aKeep); } void TextureClient::ForceRemove(bool sync) diff --git a/gfx/layers/client/TextureClient.h b/gfx/layers/client/TextureClient.h index 19a50191dbfe..856ac851678b 100644 --- a/gfx/layers/client/TextureClient.h +++ b/gfx/layers/client/TextureClient.h @@ -403,7 +403,7 @@ public: * It's a temporary hack to ensure that DXGI textures don't get destroyed * between serialization and deserialization. */ - void KeepUntilFullDeallocation(KeepAlive* aKeep); + void KeepUntilFullDeallocation(UniquePtr aKeep); /** * Create and init the TextureChild/Parent IPDL actor pair. diff --git a/gfx/layers/d3d11/TextureD3D11.cpp b/gfx/layers/d3d11/TextureD3D11.cpp index 9789e994fab0..555168b760c6 100644 --- a/gfx/layers/d3d11/TextureD3D11.cpp +++ b/gfx/layers/d3d11/TextureD3D11.cpp @@ -179,9 +179,9 @@ TextureClientD3D11::~TextureClientD3D11() { if (mActor) { if (mTexture) { - KeepUntilFullDeallocation(new TKeepAlive(mTexture10)); + KeepUntilFullDeallocation(MakeUnique>(mTexture10)); } else if (mTexture10) { - KeepUntilFullDeallocation(new TKeepAlive(mTexture)); + KeepUntilFullDeallocation(MakeUnique>(mTexture)); } } #ifdef DEBUG diff --git a/gfx/layers/d3d9/TextureD3D9.cpp b/gfx/layers/d3d9/TextureD3D9.cpp index 1db07aefa0f0..c8bf9273a75a 100644 --- a/gfx/layers/d3d9/TextureD3D9.cpp +++ b/gfx/layers/d3d9/TextureD3D9.cpp @@ -739,7 +739,7 @@ SharedTextureClientD3D9::SharedTextureClientD3D9(ISurfaceAllocator* aAllocator, SharedTextureClientD3D9::~SharedTextureClientD3D9() { if (mTexture && mActor) { - KeepUntilFullDeallocation(new TKeepAlive(mTexture)); + KeepUntilFullDeallocation(MakeUnique>(mTexture)); } if (mTexture) { gfxWindowsPlatform::sD3D9SharedTextureUsed -= mDesc.Width * mDesc.Height * 4; diff --git a/gfx/layers/d3d9/TextureD3D9.h b/gfx/layers/d3d9/TextureD3D9.h index 6f4d239c472c..fb0d40479380 100644 --- a/gfx/layers/d3d9/TextureD3D9.h +++ b/gfx/layers/d3d9/TextureD3D9.h @@ -266,7 +266,9 @@ public: mTexture = aTexture; mHandle = aSharedHandle; mDesc = aDesc; - gfxWindowsPlatform::sD3D9SharedTextureUsed += mDesc.Width * mDesc.Height * 4; + if (mTexture) { + gfxWindowsPlatform::sD3D9SharedTextureUsed += mDesc.Width * mDesc.Height * 4; + } } virtual gfx::IntSize GetSize() const From 546726bf1eb54beb9fe82ed737e24a2832d65532 Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Tue, 17 Feb 2015 16:32:31 -0800 Subject: [PATCH 020/115] Bug 1127448 - Use indexOf instead of includes. r=mconley Array.prototype.includes is nightly-only for the moment. Thanks to Gavin Sharp for pointing this out. --HG-- extra : amend_source : 9b2fc81b1a7e7304645e5321caaca1bc8eee486d --- browser/components/nsBrowserGlue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index 1eb868bcf6fa..8bf3ae03fbf5 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -2876,7 +2876,7 @@ var DebugUserAgent = { }, onRequest: function(channel, defaultUA) { - if (this.DOMAINS.includes(channel.URI.host)) { + if (this.DOMAINS.indexOf(channel.URI.host) != -1) { return this.DEBUG_UA; } return null; From a58c7f2ab4391624fce582ed08a1f766b65b85c2 Mon Sep 17 00:00:00 2001 From: David Major Date: Wed, 18 Feb 2015 14:09:32 +1300 Subject: [PATCH 021/115] Bug 1132663 - Part 1: Use the DLL blocklist in plugin-container processes. r=bsmedberg --- toolkit/xre/nsEmbedFunctions.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index 48a232929ad0..29b044c35f55 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -69,6 +69,7 @@ #include "mozilla/ipc/TestShellParent.h" #include "mozilla/ipc/XPCShellEnvironment.h" +#include "mozilla/WindowsDllBlocklist.h" #include "GMPProcessChild.h" #include "GMPLoader.h" @@ -300,6 +301,10 @@ XRE_InitChildProcess(int aArgc, NS_ENSURE_ARG_POINTER(aArgv); NS_ENSURE_ARG_POINTER(aArgv[0]); +#ifdef HAS_DLL_BLOCKLIST + DllBlocklist_Initialize(); +#endif + #if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_GONK) // On non-Fennec Gecko, the GMPLoader code resides in plugin-container, // and we must forward it through to the GMP code here. From a3c2dc90a9bfd8f753da868ae23ba0727b5e9491 Mon Sep 17 00:00:00 2001 From: David Major Date: Wed, 18 Feb 2015 14:12:41 +1300 Subject: [PATCH 022/115] Bug 1132663 - Part 2: Block rndlnpshimswf.dll and rndlmainbrowserrecordplugin.dll. r=bsmedberg --- mozglue/build/WindowsDllBlocklist.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mozglue/build/WindowsDllBlocklist.cpp b/mozglue/build/WindowsDllBlocklist.cpp index 4ce958fdca08..963128c01142 100644 --- a/mozglue/build/WindowsDllBlocklist.cpp +++ b/mozglue/build/WindowsDllBlocklist.cpp @@ -165,6 +165,10 @@ static DllBlockInfo sWindowsDllBlocklist[] = { { "windowsapihookdll32.dll", UNVERSIONED }, { "windowsapihookdll64.dll", UNVERSIONED }, + // Flash crashes with RealNetworks RealDownloader, bug 1132663 + { "rndlnpshimswf.dll", ALL_VERSIONS }, + { "rndlmainbrowserrecordplugin.dll", ALL_VERSIONS }, + { nullptr, 0 } }; From d658bd2d70017e54b13a6c16c89cde1ca200955e Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Tue, 17 Feb 2015 19:26:52 -0600 Subject: [PATCH 023/115] Bug 1132427. Add test. --- image/test/mochitest/bug1132427.gif | Bin 0 -> 634 bytes image/test/mochitest/bug1132427.html | 6 ++ image/test/mochitest/chrome.ini | 3 + image/test/mochitest/test_bug1132427.html | 96 ++++++++++++++++++++++ 4 files changed, 105 insertions(+) create mode 100644 image/test/mochitest/bug1132427.gif create mode 100644 image/test/mochitest/bug1132427.html create mode 100644 image/test/mochitest/test_bug1132427.html diff --git a/image/test/mochitest/bug1132427.gif b/image/test/mochitest/bug1132427.gif new file mode 100644 index 0000000000000000000000000000000000000000..39f49689a0ab5ce727666a278e69e946ed4f4776 GIT binary patch literal 634 zcmZ?wbhEHbJi%~+;UfdX|NsBb{QnQ685kH8|8x7fh6Fo12DlpO889<~gnqKHZ~-NC zfNY?K6ATPY|6BT3o_@=}c+Qqv-J9?2`OV+<$Ya{G&SkGoZF|Rk{FBf1Z@tfdo%{Ze zpNFgc$fA!OK3dbyEc?va>$UvKs;^yVv$o$^_nn)s`}mVhKYRREUw^ahH*f#x=U;aH z?K}Va`=5RP`6V{EXYRcD!y~I}>l>R}+dFsd z-m`b#{^ga^v-69~tLvM$Zr{0k@BZ=0>)ZRs=hyeoU%&tS{rCU*4Hg_|WZ{;w=`dJ$ zsFg?Bs)oaG(UDFO?WjE+hKrB&vdLIi=>($%4I=|Ew3wKD7_o-fl+h3ag_tz}CB8T8 literal 0 HcmV?d00001 diff --git a/image/test/mochitest/bug1132427.html b/image/test/mochitest/bug1132427.html new file mode 100644 index 000000000000..c765ce14cac3 --- /dev/null +++ b/image/test/mochitest/bug1132427.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/image/test/mochitest/chrome.ini b/image/test/mochitest/chrome.ini index 02603b775ba7..465cec64223e 100644 --- a/image/test/mochitest/chrome.ini +++ b/image/test/mochitest/chrome.ini @@ -28,6 +28,8 @@ support-files = rillybad.jpg transparent.gif transparent.png + bug1132427.html + bug1132427.gif [test_animSVGImage.html] [test_animSVGImage2.html] @@ -50,3 +52,4 @@ disabled = bug 1101415 [test_undisplayed_iframe.html] disabled = bug 1060869 [test_xultree_animation.xhtml] +[test_bug1132427.html] diff --git a/image/test/mochitest/test_bug1132427.html b/image/test/mochitest/test_bug1132427.html new file mode 100644 index 000000000000..32689a5ebf89 --- /dev/null +++ b/image/test/mochitest/test_bug1132427.html @@ -0,0 +1,96 @@ + + + + Test for scrolling selection into view + + + + + + +
+
+
+ + + From eda1e0c4c732af0e41d3607ceb02a5ae5d27a6d8 Mon Sep 17 00:00:00 2001 From: Edwin Flores Date: Wed, 18 Feb 2015 15:33:42 +1300 Subject: [PATCH 024/115] Bug 1133634 - Fix CanPlayType in GStreamer backend - r=kinetik --- dom/media/gstreamer/GStreamerFormatHelper.cpp | 24 +++++++++---------- dom/media/gstreamer/GStreamerFormatHelper.h | 10 +------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/dom/media/gstreamer/GStreamerFormatHelper.cpp b/dom/media/gstreamer/GStreamerFormatHelper.cpp index 92000a870822..25095e733e6f 100644 --- a/dom/media/gstreamer/GStreamerFormatHelper.cpp +++ b/dom/media/gstreamer/GStreamerFormatHelper.cpp @@ -224,25 +224,15 @@ GStreamerFormatHelper::IsBlacklistEnabled() } /* static */ bool -GStreamerFormatHelper::IsPluginFeatureBlacklisted(GstPluginFeature *aFeature, - FactoryType aTypes) +GStreamerFormatHelper::IsPluginFeatureBlacklisted(GstPluginFeature *aFeature) { if (!IsBlacklistEnabled()) { return false; } - const gchar *className = - gst_element_factory_get_klass(GST_ELEMENT_FACTORY_CAST(aFeature)); - const gchar *factoryName = gst_plugin_feature_get_name(aFeature); - if ((!(aTypes & FactoryTypeDecoder) && strstr(className, "Decoder")) || - (!(aTypes & FactoryTypeDemuxer) && strstr(className, "Demuxer")) || - (!(aTypes & FactoryTypeParser) && strstr(className, "Parser"))) { - return false; - } - for (unsigned int i = 0; i < G_N_ELEMENTS(sPluginBlacklist); i++) { if (!strcmp(factoryName, sPluginBlacklist[i])) { return true; @@ -258,8 +248,16 @@ static gboolean FactoryFilter(GstPluginFeature *aFeature, gpointer) return FALSE; } - return !GStreamerFormatHelper::IsPluginFeatureBlacklisted(aFeature, - (FactoryType)(FactoryTypeDecoder|FactoryTypeDemuxer)); + const gchar *className = + gst_element_factory_get_klass(GST_ELEMENT_FACTORY_CAST(aFeature)); + + if (!strstr(className, "Decoder") && !strstr(className, "Demux")) { + return FALSE; + } + + return + gst_plugin_feature_get_rank(aFeature) >= GST_RANK_MARGINAL && + !GStreamerFormatHelper::IsPluginFeatureBlacklisted(aFeature); } /** diff --git a/dom/media/gstreamer/GStreamerFormatHelper.h b/dom/media/gstreamer/GStreamerFormatHelper.h index 94bb8e03ca58..55ddcfb52343 100644 --- a/dom/media/gstreamer/GStreamerFormatHelper.h +++ b/dom/media/gstreamer/GStreamerFormatHelper.h @@ -13,13 +13,6 @@ namespace mozilla { -enum FactoryType { - FactoryTypeDecoder = 1 << 0, - FactoryTypeDemuxer = 1 << 1, - FactoryTypeParser = 1 << 2, - FactoryTypeAll = FactoryTypeDecoder|FactoryTypeDemuxer|FactoryTypeParser -}; - class GStreamerFormatHelper { /* This class can be used to query the GStreamer registry for the required * demuxers/decoders from nsHTMLMediaElement::CanPlayType. @@ -37,8 +30,7 @@ class GStreamerFormatHelper { bool CanHandleCodecCaps(GstCaps* aCaps); static bool IsBlacklistEnabled(); - static bool IsPluginFeatureBlacklisted(GstPluginFeature *aFeature, - FactoryType aTypes = FactoryTypeAll); + static bool IsPluginFeatureBlacklisted(GstPluginFeature *aFeature); static GstCaps* ConvertFormatsToCaps(const char* aMIMEType, const nsAString* aCodecs); From a8afe737e913bf413a58a1feb0403d5f95586e4d Mon Sep 17 00:00:00 2001 From: Blake Wu Date: Mon, 16 Feb 2015 11:16:31 +0800 Subject: [PATCH 025/115] Bug 1123669 - Reset mDrainComplete flag and implement overridden flush() for audio. r=ajones --- dom/media/fmp4/gonk/GonkAudioDecoderManager.cpp | 10 ++++++++++ dom/media/fmp4/gonk/GonkAudioDecoderManager.h | 2 ++ dom/media/fmp4/gonk/GonkMediaDataDecoder.cpp | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dom/media/fmp4/gonk/GonkAudioDecoderManager.cpp b/dom/media/fmp4/gonk/GonkAudioDecoderManager.cpp index 0446f691b77b..fc20b562de0d 100644 --- a/dom/media/fmp4/gonk/GonkAudioDecoderManager.cpp +++ b/dom/media/fmp4/gonk/GonkAudioDecoderManager.cpp @@ -247,4 +247,14 @@ void GonkAudioDecoderManager::ReleaseAudioBuffer() { } } +nsresult +GonkAudioDecoderManager::Flush() +{ + GonkDecoderManager::Flush(); + status_t err = mDecoder->flush(); + if (err != OK) { + return NS_ERROR_FAILURE; + } + return NS_OK; +} } // namespace mozilla diff --git a/dom/media/fmp4/gonk/GonkAudioDecoderManager.h b/dom/media/fmp4/gonk/GonkAudioDecoderManager.h index 6409350dae9d..a10c87eff026 100644 --- a/dom/media/fmp4/gonk/GonkAudioDecoderManager.h +++ b/dom/media/fmp4/gonk/GonkAudioDecoderManager.h @@ -32,6 +32,8 @@ public: virtual nsresult Output(int64_t aStreamOffset, nsRefPtr& aOutput) MOZ_OVERRIDE; + virtual nsresult Flush() MOZ_OVERRIDE; + protected: virtual bool PerformFormatSpecificProcess(mp4_demuxer::MP4Sample* aSample) MOZ_OVERRIDE; diff --git a/dom/media/fmp4/gonk/GonkMediaDataDecoder.cpp b/dom/media/fmp4/gonk/GonkMediaDataDecoder.cpp index cee591764144..3e3ad61c5efd 100644 --- a/dom/media/fmp4/gonk/GonkMediaDataDecoder.cpp +++ b/dom/media/fmp4/gonk/GonkMediaDataDecoder.cpp @@ -234,7 +234,7 @@ GonkMediaDataDecoder::Flush() // it's executing at all. Note the MP4Reader ignores all output while // flushing. mTaskQueue->Flush(); - + mDrainComplete = false; return mManager->Flush(); } From 6a7427dbba3d951693c113a4f0cf2a8da2c7437f Mon Sep 17 00:00:00 2001 From: Alexandre Lissy Date: Tue, 3 Feb 2015 10:49:00 -0500 Subject: [PATCH 026/115] Bug 1128986 - Update gaia_lock_screen.js. r=jgriffin --- layout/tools/reftest/gaia_lock_screen.js | 82 ++++++++---------------- 1 file changed, 26 insertions(+), 56 deletions(-) diff --git a/layout/tools/reftest/gaia_lock_screen.js b/layout/tools/reftest/gaia_lock_screen.js index ad1febb2fe26..ca0953e91c2a 100644 --- a/layout/tools/reftest/gaia_lock_screen.js +++ b/layout/tools/reftest/gaia_lock_screen.js @@ -6,85 +6,55 @@ // https://github.com/mozilla-b2g/gaia/blob/master/tests/atoms/gaia_lock_screen.js 'use strict'; +/* globals waitFor, finish */ +/* exported GaiaLockScreen */ var GaiaLockScreen = { - unlock: function() { - let lockscreen = window.wrappedJSObject.lockScreen; + unlock: function(forcibly) { let setlock = window.wrappedJSObject.SettingsListener.getSettingsLock(); - let system = window.wrappedJSObject.System; + let service = window.wrappedJSObject.Service; let obj = {'screen.timeout': 0}; setlock.set(obj); - window.wrappedJSObject.ScreenManager.turnScreenOn(); - waitFor( function() { - window.wrappedJSObject.dispatchEvent( - new window.wrappedJSObject.CustomEvent( - 'lockscreen-request-unlock', { - detail: { - forcibly: true - } - })); + service.request('unlock', { forcibly: forcibly }); waitFor( function() { - finish(system.locked); + finish(service.locked); }, function() { - return !system.locked; + return !service.locked; } ); }, function() { - return !!lockscreen; + return !!service; } ); }, - lock: function() { - let lwm = window.wrappedJSObject.lockScreenWindowManager; - let lockscreen = window.wrappedJSObject.lockScreen; - let system = window.wrappedJSObject.System; + lock: function(forcibly) { + let service = window.wrappedJSObject.Service; let setlock = window.wrappedJSObject.SettingsListener.getSettingsLock(); let obj = {'screen.timeout': 0}; - let waitLock = function() { - waitFor( - function() { - window.wrappedJSObject.dispatchEvent( - new window.wrappedJSObject.CustomEvent( - 'lockscreen-request-lock', { - detail: { - forcibly: true - } - })); - waitFor( - function() { - finish(!system.locked); - }, - function() { - return system.locked; - } - ); - }, - function() { - return !!lockscreen; - } - ); - }; - setlock.set(obj); - window.wrappedJSObject.ScreenManager.turnScreenOn(); - - // Need to open the window before we lock the lockscreen. - // This would only happen when someone directly call the lockscrene.lock. - // It's a bad pattern and would only for test. - lwm.openApp(); - waitFor(function() { - waitLock(); - }, function() { - return lwm.states.instance.isActive(); - }); + waitFor( + function() { + service.request('lock', { forcibly: forcibly }); + waitFor( + function() { + finish(!service.locked); + }, + function() { + return service.locked; + } + ); + }, + function() { + return !!service; + } + ); } }; - From 1194d9a39f3edd2389671b2798db17749c51cc5d Mon Sep 17 00:00:00 2001 From: Josh Grant Date: Mon, 16 Feb 2015 10:57:10 -0500 Subject: [PATCH 027/115] Bug 1128515 - Update session_capabilities property. r=dburns --HG-- extra : transplant_source : %B5%80rL%CC%80%EDJ%BC%3A%5CU%E0%F1B%27%1D%1Dc%0E extra : histedit_source : 1536b5b945e6dc00ee3cc8c022834ed1f41cece9%2Ca5207086a268c1e2d12d451faff1e11e23cfe0be --- testing/marionette/client/marionette/marionette.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/testing/marionette/client/marionette/marionette.py b/testing/marionette/client/marionette/marionette.py index 762ddb8847a7..39c91150a5b3 100644 --- a/testing/marionette/client/marionette/marionette.py +++ b/testing/marionette/client/marionette/marionette.py @@ -910,8 +910,7 @@ class Marionette(object): ''' A JSON dictionary representing the capabilities of the current session. ''' - response = self._send_message('getSessionCapabilities', 'value') - return response + return self.session def set_script_timeout(self, timeout): ''' From 860930550ded2311bb134b3a10f0da3dbebc8d27 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 18 Feb 2015 17:20:02 +1300 Subject: [PATCH 028/115] Bug 1133697 part 1 - Remove aForFrame check in BuildTextRuns. r=roc The only caller of BuildTextRuns passes |this| as |aForFrame|, which must never be nullptr, hence it's safe to remove the checks there. --HG-- extra : source : 140bf27dd11cb63815bb558e4b8dc37dfc918132 --- layout/generic/nsTextFrame.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 303cc8b1a64e..11a6bac48641 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -1255,8 +1255,7 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame, const nsLineList::iterator* aForFrameLine, nsTextFrame::TextRunType aWhichTextRun) { - NS_ASSERTION(aForFrame || aLineContainer, - "One of aForFrame or aLineContainer must be set!"); + MOZ_ASSERT(aForFrame, "for no frame?"); NS_ASSERTION(!aForFrameLine || aLineContainer, "line but no line container"); @@ -1268,25 +1267,22 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame, } aLineContainer = FindLineContainer(lineContainerChild); } else { - NS_ASSERTION(!aForFrame || - (aLineContainer == FindLineContainer(aForFrame) || + NS_ASSERTION((aLineContainer == FindLineContainer(aForFrame) || aLineContainer->GetType() == nsGkAtoms::rubyTextContainerFrame || (aLineContainer->GetType() == nsGkAtoms::letterFrame && aLineContainer->IsFloating())), "Wrong line container hint"); } - if (aForFrame) { - if (aForFrame->HasAnyStateBits(TEXT_IS_IN_TOKEN_MATHML)) { - aLineContainer->AddStateBits(TEXT_IS_IN_TOKEN_MATHML); - if (aForFrame->HasAnyStateBits(NS_FRAME_IS_IN_SINGLE_CHAR_MI)) { - aLineContainer->AddStateBits(NS_FRAME_IS_IN_SINGLE_CHAR_MI); - } - } - if (aForFrame->HasAnyStateBits(NS_FRAME_MATHML_SCRIPT_DESCENDANT)) { - aLineContainer->AddStateBits(NS_FRAME_MATHML_SCRIPT_DESCENDANT); + if (aForFrame->HasAnyStateBits(TEXT_IS_IN_TOKEN_MATHML)) { + aLineContainer->AddStateBits(TEXT_IS_IN_TOKEN_MATHML); + if (aForFrame->HasAnyStateBits(NS_FRAME_IS_IN_SINGLE_CHAR_MI)) { + aLineContainer->AddStateBits(NS_FRAME_IS_IN_SINGLE_CHAR_MI); } } + if (aForFrame->HasAnyStateBits(NS_FRAME_MATHML_SCRIPT_DESCENDANT)) { + aLineContainer->AddStateBits(NS_FRAME_MATHML_SCRIPT_DESCENDANT); + } nsPresContext* presContext = aLineContainer->PresContext(); BuildTextRunsScanner scanner(presContext, aContext, aLineContainer, From 46ca97ae3898eb53c28e342f6a5083b24d3228f7 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 18 Feb 2015 17:20:02 +1300 Subject: [PATCH 029/115] Bug 1133697 part 2 - Scan ruby texts instead of their container for building text run. r=roc --HG-- extra : source : 2c39dfb432eea53185ed28c5790cf472bf09abf8 --- layout/generic/nsTextFrame.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 11a6bac48641..1622cbdbe5dd 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -1268,7 +1268,6 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame, aLineContainer = FindLineContainer(lineContainerChild); } else { NS_ASSERTION((aLineContainer == FindLineContainer(aForFrame) || - aLineContainer->GetType() == nsGkAtoms::rubyTextContainerFrame || (aLineContainer->GetType() == nsGkAtoms::letterFrame && aLineContainer->IsFloating())), "Wrong line container hint"); @@ -1291,13 +1290,26 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame, nsBlockFrame* block = nsLayoutUtils::GetAsBlock(aLineContainer); if (!block) { - NS_ASSERTION(!aLineContainer->GetPrevInFlow() && !aLineContainer->GetNextInFlow(), - "Breakable non-block line containers not supported"); + nsIFrame* textRunContainer = aLineContainer; + if (aLineContainer->GetType() == nsGkAtoms::rubyTextContainerFrame) { + textRunContainer = aForFrame; + while (textRunContainer && + textRunContainer->GetType() != nsGkAtoms::rubyTextFrame) { + textRunContainer = textRunContainer->GetParent(); + } + MOZ_ASSERT(textRunContainer && + textRunContainer->GetParent() == aLineContainer); + } else { + NS_ASSERTION( + !aLineContainer->GetPrevInFlow() && !aLineContainer->GetNextInFlow(), + "Breakable non-block line containers other than " + "ruby text container is not supported"); + } // Just loop through all the children of the linecontainer ... it's really // just one line scanner.SetAtStartOfLine(); scanner.SetCommonAncestorWithLastFrame(nullptr); - nsIFrame* child = aLineContainer->GetFirstPrincipalChild(); + nsIFrame* child = textRunContainer->GetFirstPrincipalChild(); while (child) { scanner.ScanFrame(child); child = child->GetNextSibling(); From af2bbac201d9f1ccedba5d98faf00fd4320b056c Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 18 Feb 2015 17:20:02 +1300 Subject: [PATCH 030/115] Bug 1133697 part 3 - Make ruby text frame not continue text run. r=roc --HG-- extra : source : b9d1f775565347a2bc506b163b91b5c522e0a366 --- layout/generic/nsLineLayout.cpp | 7 ++++--- layout/generic/nsLineLayout.h | 3 +++ layout/generic/nsRubyBaseContainerFrame.cpp | 1 + layout/generic/nsRubyTextFrame.cpp | 6 ++++++ layout/generic/nsRubyTextFrame.h | 1 + layout/reftests/css-ruby/reftest.list | 2 +- 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index a3dcd3412078..c52a40d0afec 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -80,7 +80,8 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext, mHasBullet(false), mDirtyNextLine(false), mLineAtStart(false), - mHasRuby(false) + mHasRuby(false), + mSuppressLineWrap(aOuterReflowState->frame->IsSVGText()) { MOZ_ASSERT(aOuterReflowState, "aOuterReflowState must not be null"); NS_ASSERTION(aFloatManager || aOuterReflowState->frame->GetType() == @@ -225,8 +226,7 @@ nsLineLayout::BeginLineReflow(nscoord aICoord, nscoord aBCoord, mBStartEdge = aBCoord; - psd->mNoWrap = - !mStyleText->WhiteSpaceCanWrapStyle() || LineContainerFrame()->IsSVGText(); + psd->mNoWrap = !mStyleText->WhiteSpaceCanWrapStyle() || mSuppressLineWrap; psd->mWritingMode = aWritingMode; // If this is the first line of a block then see if the text-indent @@ -457,6 +457,7 @@ nsLineLayout::BeginSpan(nsIFrame* aFrame, nsIFrame* frame = aSpanReflowState->frame; psd->mNoWrap = !frame->StyleText()->WhiteSpaceCanWrap(frame) || + mSuppressLineWrap || frame->StyleContext()->IsInlineDescendantOfRuby(); psd->mWritingMode = aSpanReflowState->GetWritingMode(); diff --git a/layout/generic/nsLineLayout.h b/layout/generic/nsLineLayout.h index f78061a6b39a..2c7f9aa58836 100644 --- a/layout/generic/nsLineLayout.h +++ b/layout/generic/nsLineLayout.h @@ -368,6 +368,8 @@ public: */ nscoord GetCurrentICoord() { return mCurrentSpan->mICoord; } + void SetSuppressLineWrap(bool aEnabled) { mSuppressLineWrap = aEnabled; } + protected: // This state is constant for a given block frame doing line layout nsFloatManager* mFloatManager; @@ -598,6 +600,7 @@ protected: bool mDirtyNextLine : 1; bool mLineAtStart : 1; bool mHasRuby : 1; + bool mSuppressLineWrap : 1; int32_t mSpanDepth; #ifdef DEBUG diff --git a/layout/generic/nsRubyBaseContainerFrame.cpp b/layout/generic/nsRubyBaseContainerFrame.cpp index 66f9de3c808d..a84b91b1b9b6 100644 --- a/layout/generic/nsRubyBaseContainerFrame.cpp +++ b/layout/generic/nsRubyBaseContainerFrame.cpp @@ -376,6 +376,7 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext, reflowState->mFloatManager, reflowState, nullptr, aReflowState.mLineLayout); + lineLayout->SetSuppressLineWrap(true); lineLayouts.AppendElement(lineLayout); // Line number is useless for ruby text diff --git a/layout/generic/nsRubyTextFrame.cpp b/layout/generic/nsRubyTextFrame.cpp index 04655e08d654..23901e2d7d31 100644 --- a/layout/generic/nsRubyTextFrame.cpp +++ b/layout/generic/nsRubyTextFrame.cpp @@ -44,6 +44,12 @@ nsRubyTextFrame::GetType() const return nsGkAtoms::rubyTextFrame; } +/* virtual */ bool +nsRubyTextFrame::CanContinueTextRun() const +{ + return false; +} + #ifdef DEBUG_FRAME_DUMP nsresult nsRubyTextFrame::GetFrameName(nsAString& aResult) const diff --git a/layout/generic/nsRubyTextFrame.h b/layout/generic/nsRubyTextFrame.h index 582f0d44b341..6e7438aca23d 100644 --- a/layout/generic/nsRubyTextFrame.h +++ b/layout/generic/nsRubyTextFrame.h @@ -29,6 +29,7 @@ public: // nsIFrame overrides virtual nsIAtom* GetType() const MOZ_OVERRIDE; + virtual bool CanContinueTextRun() const MOZ_OVERRIDE; #ifdef DEBUG_FRAME_DUMP virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; diff --git a/layout/reftests/css-ruby/reftest.list b/layout/reftests/css-ruby/reftest.list index e5905e11d51c..aa77ed3b1f8e 100644 --- a/layout/reftests/css-ruby/reftest.list +++ b/layout/reftests/css-ruby/reftest.list @@ -29,7 +29,7 @@ default-preferences pref(layout.css.ruby.enabled,true) == intra-level-whitespace-3.html intra-level-whitespace-3-ref.html == justification-1.html justification-1-ref.html == justification-2.html justification-2-ref.html -asserts-if(winWidget,0-1) == line-breaking-1.html line-breaking-1-ref.html # bug 1133697 +== line-breaking-1.html line-breaking-1-ref.html == line-height-1.html line-height-1-ref.html == line-height-2.html line-height-2-ref.html == line-height-3.html line-height-3-ref.html From 8db771ea2907f7b5628a5315b95dab7499bea341 Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Wed, 18 Feb 2015 13:41:35 +0900 Subject: [PATCH 031/115] Bug 1129920 - Separate String.prototype.normalize test into small parts. r=Waldo --- .../String/normalize-generateddata-part0.js | 22 +++ ...ormalize-generateddata-part1-not-listed.js | 38 ++++++ .../String/normalize-generateddata-part1.js | 22 +++ .../String/normalize-generateddata-part2.js | 22 +++ .../String/normalize-generateddata-part3.js | 22 +++ .../ecma_6/String/normalize-generateddata.js | 126 ------------------ .../tests/ecma_6/String/normalize-generic.js | 20 +++ .../ecma_6/String/normalize-parameter.js | 19 +++ js/src/tests/ecma_6/String/normalize-rope.js | 23 ++++ js/src/tests/ecma_6/String/shell.js | 59 ++++++++ 10 files changed, 247 insertions(+), 126 deletions(-) create mode 100644 js/src/tests/ecma_6/String/normalize-generateddata-part0.js create mode 100644 js/src/tests/ecma_6/String/normalize-generateddata-part1-not-listed.js create mode 100644 js/src/tests/ecma_6/String/normalize-generateddata-part1.js create mode 100644 js/src/tests/ecma_6/String/normalize-generateddata-part2.js create mode 100644 js/src/tests/ecma_6/String/normalize-generateddata-part3.js delete mode 100644 js/src/tests/ecma_6/String/normalize-generateddata.js create mode 100644 js/src/tests/ecma_6/String/normalize-generic.js create mode 100644 js/src/tests/ecma_6/String/normalize-parameter.js create mode 100644 js/src/tests/ecma_6/String/normalize-rope.js diff --git a/js/src/tests/ecma_6/String/normalize-generateddata-part0.js b/js/src/tests/ecma_6/String/normalize-generateddata-part0.js new file mode 100644 index 000000000000..a9bed5b141c4 --- /dev/null +++ b/js/src/tests/ecma_6/String/normalize-generateddata-part0.js @@ -0,0 +1,22 @@ +// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function + +var BUGNUMBER = 918987; +var summary = 'String.prototype.normalize - part0'; + +print(BUGNUMBER + ": " + summary); + +function test() { + load('ecma_6/String/normalize-generateddata-input.js'); + + for (var test0 of tests_part0) { + runNormalizeTest(test0); + } +} + +if ("normalize" in String.prototype) { + // String.prototype.normalize is not enabled in all builds. + test(); +} + +if (typeof reportCompare === "function") + reportCompare(true, true); diff --git a/js/src/tests/ecma_6/String/normalize-generateddata-part1-not-listed.js b/js/src/tests/ecma_6/String/normalize-generateddata-part1-not-listed.js new file mode 100644 index 000000000000..c15fff66003b --- /dev/null +++ b/js/src/tests/ecma_6/String/normalize-generateddata-part1-not-listed.js @@ -0,0 +1,38 @@ +// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function + +var BUGNUMBER = 918987; +var summary = 'String.prototype.normalize - not listed in part1'; + +print(BUGNUMBER + ": " + summary); + +function test() { + load('ecma_6/String/normalize-generateddata-input.js'); + + var part1 = new Set(); + for (var test1 of tests_part1) { + part1.add(test1.source[0]); + } + + /* not listed in Part 1 */ + for (var x = 0; x <= 0x2FFFF; x++) { + if (part1.has(x)) { + continue; + } + var xstr = x.toString(16); + var c = String.fromCodePoint(x); + assertEq(c.normalize(), c, "NFC of " + xstr); + assertEq(c.normalize(undefined), c, "NFC of " + xstr); + assertEq(c.normalize("NFC"), c, "NFC of " + xstr); + assertEq(c.normalize("NFD"), c, "NFD of " + xstr); + assertEq(c.normalize("NFKC"), c, "NFKC of " + xstr); + assertEq(c.normalize("NFKD"), c, "NFKD of " + xstr); + } +} + +if ("normalize" in String.prototype) { + // String.prototype.normalize is not enabled in all builds. + test(); +} + +if (typeof reportCompare === "function") + reportCompare(true, true); diff --git a/js/src/tests/ecma_6/String/normalize-generateddata-part1.js b/js/src/tests/ecma_6/String/normalize-generateddata-part1.js new file mode 100644 index 000000000000..b2a90f5e832f --- /dev/null +++ b/js/src/tests/ecma_6/String/normalize-generateddata-part1.js @@ -0,0 +1,22 @@ +// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function + +var BUGNUMBER = 918987; +var summary = 'String.prototype.normalize - part1'; + +print(BUGNUMBER + ": " + summary); + +function test() { + load('ecma_6/String/normalize-generateddata-input.js'); + + for (var test1 of tests_part1) { + runNormalizeTest(test1); + } +} + +if ("normalize" in String.prototype) { + // String.prototype.normalize is not enabled in all builds. + test(); +} + +if (typeof reportCompare === "function") + reportCompare(true, true); diff --git a/js/src/tests/ecma_6/String/normalize-generateddata-part2.js b/js/src/tests/ecma_6/String/normalize-generateddata-part2.js new file mode 100644 index 000000000000..6a942b3a1cbb --- /dev/null +++ b/js/src/tests/ecma_6/String/normalize-generateddata-part2.js @@ -0,0 +1,22 @@ +// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function + +var BUGNUMBER = 918987; +var summary = 'String.prototype.normalize - part2'; + +print(BUGNUMBER + ": " + summary); + +function test() { + load('ecma_6/String/normalize-generateddata-input.js'); + + for (var test2 of tests_part2) { + runNormalizeTest(test2); + } +} + +if ("normalize" in String.prototype) { + // String.prototype.normalize is not enabled in all builds. + test(); +} + +if (typeof reportCompare === "function") + reportCompare(true, true); diff --git a/js/src/tests/ecma_6/String/normalize-generateddata-part3.js b/js/src/tests/ecma_6/String/normalize-generateddata-part3.js new file mode 100644 index 000000000000..d02792701dc2 --- /dev/null +++ b/js/src/tests/ecma_6/String/normalize-generateddata-part3.js @@ -0,0 +1,22 @@ +// |reftest| skip-if(!xulRuntime.shell) -- uses shell load() function + +var BUGNUMBER = 918987; +var summary = 'String.prototype.normalize - part3'; + +print(BUGNUMBER + ": " + summary); + +function test() { + load('ecma_6/String/normalize-generateddata-input.js'); + + for (var test3 of tests_part3) { + runNormalizeTest(test3); + } +} + +if ("normalize" in String.prototype) { + // String.prototype.normalize is not enabled in all builds. + test(); +} + +if (typeof reportCompare === "function") + reportCompare(true, true); diff --git a/js/src/tests/ecma_6/String/normalize-generateddata.js b/js/src/tests/ecma_6/String/normalize-generateddata.js deleted file mode 100644 index e5c19d97f4b7..000000000000 --- a/js/src/tests/ecma_6/String/normalize-generateddata.js +++ /dev/null @@ -1,126 +0,0 @@ -// |reftest| skip-if(!xulRuntime.shell||!("normalize"in(String.prototype))) -- uses shell load() function, String.prototype.normalize is not enabled in all builds -var BUGNUMBER = 918987; -var summary = 'String.prototype.normalize'; - -print(BUGNUMBER + ": " + summary); - -/************** - * BEGIN TEST * - **************/ - -load('ecma_6/String/normalize-generateddata-input.js'); - -function codePointsToString(points) { - return points.map(x => String.fromCodePoint(x)).join(""); -} -function stringify(points) { - return points.map(x => x.toString(16)).join(); -} - -function runTest(test) { - var source = codePointsToString(test.source); - var NFC = codePointsToString(test.NFC); - var NFD = codePointsToString(test.NFD); - var NFKC = codePointsToString(test.NFKC); - var NFKD = codePointsToString(test.NFKD); - var sourceStr = stringify(test.source); - var nfcStr = stringify(test.NFC); - var nfdStr = stringify(test.NFD); - var nfkcStr = stringify(test.NFKC); - var nfkdStr = stringify(test.NFKD); - - /* NFC */ - assertEq(source.normalize(), NFC, "NFC of " + sourceStr); - assertEq(NFC.normalize(), NFC, "NFC of " + nfcStr); - assertEq(NFD.normalize(), NFC, "NFC of " + nfdStr); - assertEq(NFKC.normalize(), NFKC, "NFC of " + nfkcStr); - assertEq(NFKD.normalize(), NFKC, "NFC of " + nfkdStr); - - assertEq(source.normalize(undefined), NFC, "NFC of " + sourceStr); - assertEq(NFC.normalize(undefined), NFC, "NFC of " + nfcStr); - assertEq(NFD.normalize(undefined), NFC, "NFC of " + nfdStr); - assertEq(NFKC.normalize(undefined), NFKC, "NFC of " + nfkcStr); - assertEq(NFKD.normalize(undefined), NFKC, "NFC of " + nfkdStr); - - assertEq(source.normalize("NFC"), NFC, "NFC of " + sourceStr); - assertEq(NFC.normalize("NFC"), NFC, "NFC of " + nfcStr); - assertEq(NFD.normalize("NFC"), NFC, "NFC of " + nfdStr); - assertEq(NFKC.normalize("NFC"), NFKC, "NFC of " + nfkcStr); - assertEq(NFKD.normalize("NFC"), NFKC, "NFC of " + nfkdStr); - - /* NFD */ - assertEq(source.normalize("NFD"), NFD, "NFD of " + sourceStr); - assertEq(NFC.normalize("NFD"), NFD, "NFD of " + nfcStr); - assertEq(NFD.normalize("NFD"), NFD, "NFD of " + nfdStr); - assertEq(NFKC.normalize("NFD"), NFKD, "NFD of " + nfkcStr); - assertEq(NFKD.normalize("NFD"), NFKD, "NFD of " + nfkdStr); - - /* NFKC */ - assertEq(source.normalize("NFKC"), NFKC, "NFKC of " + sourceStr); - assertEq(NFC.normalize("NFKC"), NFKC, "NFKC of " + nfcStr); - assertEq(NFD.normalize("NFKC"), NFKC, "NFKC of " + nfdStr); - assertEq(NFKC.normalize("NFKC"), NFKC, "NFKC of " + nfkcStr); - assertEq(NFKD.normalize("NFKC"), NFKC, "NFKC of " + nfkdStr); - - /* NFKD */ - assertEq(source.normalize("NFKD"), NFKD, "NFKD of " + sourceStr); - assertEq(NFC.normalize("NFKD"), NFKD, "NFKD of " + nfcStr); - assertEq(NFD.normalize("NFKD"), NFKD, "NFKD of " + nfdStr); - assertEq(NFKC.normalize("NFKD"), NFKD, "NFKD of " + nfkcStr); - assertEq(NFKD.normalize("NFKD"), NFKD, "NFKD of " + nfkdStr); -} - -for (var test0 of tests_part0) { - runTest(test0); -} -var part1 = new Set(); -for (var test1 of tests_part1) { - part1.add(test1.source[0]); - runTest(test1); -} -for (var test2 of tests_part2) { - runTest(test2); -} -for (var test3 of tests_part3) { - runTest(test3); -} - -/* not listed in Part 1 */ -for (var x = 0; x <= 0x2FFFF; x++) { - if (part1.has(x)) { - continue; - } - var xstr = x.toString(16); - var c = String.fromCodePoint(x); - assertEq(c.normalize(), c, "NFC of " + xstr); - assertEq(c.normalize(undefined), c, "NFC of " + xstr); - assertEq(c.normalize("NFC"), c, "NFC of " + xstr); - assertEq(c.normalize("NFD"), c, "NFD of " + xstr); - assertEq(c.normalize("NFKC"), c, "NFKC of " + xstr); - assertEq(c.normalize("NFKD"), c, "NFKD of " + xstr); -} - -var myobj = {toString : (function () "a\u0301"), normalize : String.prototype.normalize}; -assertEq(myobj.normalize(), "\u00E1"); - -assertThrowsInstanceOf(function() { - "abc".normalize("NFE"); - }, RangeError, - "String.prototype.normalize should raise RangeError on invalid form"); - -assertEq("".normalize(), ""); - -/* JSRope test */ -var a = ""; -var b = ""; -for (var i = 0; i < 100; i++) { - a += "\u0100"; - b += "\u0041\u0304"; -} -assertEq(a.normalize("NFD"), b); - -/******************************************************************************/ - -if (typeof reportCompare === "function") - reportCompare(true, true); -print("Tests complete"); diff --git a/js/src/tests/ecma_6/String/normalize-generic.js b/js/src/tests/ecma_6/String/normalize-generic.js new file mode 100644 index 000000000000..c1c3882cc236 --- /dev/null +++ b/js/src/tests/ecma_6/String/normalize-generic.js @@ -0,0 +1,20 @@ +var BUGNUMBER = 918987; +var summary = 'String.prototype.normalize - normalize no String object'; + +print(BUGNUMBER + ": " + summary); + +function test() { + var myobj = { + toString: () => "a\u0301", + normalize: String.prototype.normalize + }; + assertEq(myobj.normalize(), "\u00E1"); +} + +if ("normalize" in String.prototype) { + // String.prototype.normalize is not enabled in all builds. + test(); +} + +if (typeof reportCompare === "function") + reportCompare(true, true); diff --git a/js/src/tests/ecma_6/String/normalize-parameter.js b/js/src/tests/ecma_6/String/normalize-parameter.js new file mode 100644 index 000000000000..4831c27176c0 --- /dev/null +++ b/js/src/tests/ecma_6/String/normalize-parameter.js @@ -0,0 +1,19 @@ +var BUGNUMBER = 918987; +var summary = 'String.prototype.normalize - passing wrong parameter'; + +print(BUGNUMBER + ": " + summary); + +function test() { + assertThrowsInstanceOf(() => "abc".normalize("NFE"), RangeError, + "String.prototype.normalize should raise RangeError on invalid form"); + + assertEq("".normalize(), ""); +} + +if ("normalize" in String.prototype) { + // String.prototype.normalize is not enabled in all builds. + test(); +} + +if (typeof reportCompare === "function") + reportCompare(true, true); diff --git a/js/src/tests/ecma_6/String/normalize-rope.js b/js/src/tests/ecma_6/String/normalize-rope.js new file mode 100644 index 000000000000..b5b8800fa4b5 --- /dev/null +++ b/js/src/tests/ecma_6/String/normalize-rope.js @@ -0,0 +1,23 @@ +var BUGNUMBER = 918987; +var summary = 'String.prototype.normalize - normalize rope string'; + +print(BUGNUMBER + ": " + summary); + +function test() { + /* JSRope test */ + var a = ""; + var b = ""; + for (var i = 0; i < 100; i++) { + a += "\u0100"; + b += "\u0041\u0304"; + } + assertEq(a.normalize("NFD"), b); +} + +if ("normalize" in String.prototype) { + // String.prototype.normalize is not enabled in all builds. + test(); +} + +if (typeof reportCompare === "function") + reportCompare(true, true); diff --git a/js/src/tests/ecma_6/String/shell.js b/js/src/tests/ecma_6/String/shell.js index e69de29bb2d1..25e2f7e2f5d4 100644 --- a/js/src/tests/ecma_6/String/shell.js +++ b/js/src/tests/ecma_6/String/shell.js @@ -0,0 +1,59 @@ +function runNormalizeTest(test) { + function codePointsToString(points) { + return points.map(x => String.fromCodePoint(x)).join(""); + } + function stringify(points) { + return points.map(x => x.toString(16)).join(); + } + + var source = codePointsToString(test.source); + var NFC = codePointsToString(test.NFC); + var NFD = codePointsToString(test.NFD); + var NFKC = codePointsToString(test.NFKC); + var NFKD = codePointsToString(test.NFKD); + var sourceStr = stringify(test.source); + var nfcStr = stringify(test.NFC); + var nfdStr = stringify(test.NFD); + var nfkcStr = stringify(test.NFKC); + var nfkdStr = stringify(test.NFKD); + + /* NFC */ + assertEq(source.normalize(), NFC, "NFC of " + sourceStr); + assertEq(NFC.normalize(), NFC, "NFC of " + nfcStr); + assertEq(NFD.normalize(), NFC, "NFC of " + nfdStr); + assertEq(NFKC.normalize(), NFKC, "NFC of " + nfkcStr); + assertEq(NFKD.normalize(), NFKC, "NFC of " + nfkdStr); + + assertEq(source.normalize(undefined), NFC, "NFC of " + sourceStr); + assertEq(NFC.normalize(undefined), NFC, "NFC of " + nfcStr); + assertEq(NFD.normalize(undefined), NFC, "NFC of " + nfdStr); + assertEq(NFKC.normalize(undefined), NFKC, "NFC of " + nfkcStr); + assertEq(NFKD.normalize(undefined), NFKC, "NFC of " + nfkdStr); + + assertEq(source.normalize("NFC"), NFC, "NFC of " + sourceStr); + assertEq(NFC.normalize("NFC"), NFC, "NFC of " + nfcStr); + assertEq(NFD.normalize("NFC"), NFC, "NFC of " + nfdStr); + assertEq(NFKC.normalize("NFC"), NFKC, "NFC of " + nfkcStr); + assertEq(NFKD.normalize("NFC"), NFKC, "NFC of " + nfkdStr); + + /* NFD */ + assertEq(source.normalize("NFD"), NFD, "NFD of " + sourceStr); + assertEq(NFC.normalize("NFD"), NFD, "NFD of " + nfcStr); + assertEq(NFD.normalize("NFD"), NFD, "NFD of " + nfdStr); + assertEq(NFKC.normalize("NFD"), NFKD, "NFD of " + nfkcStr); + assertEq(NFKD.normalize("NFD"), NFKD, "NFD of " + nfkdStr); + + /* NFKC */ + assertEq(source.normalize("NFKC"), NFKC, "NFKC of " + sourceStr); + assertEq(NFC.normalize("NFKC"), NFKC, "NFKC of " + nfcStr); + assertEq(NFD.normalize("NFKC"), NFKC, "NFKC of " + nfdStr); + assertEq(NFKC.normalize("NFKC"), NFKC, "NFKC of " + nfkcStr); + assertEq(NFKD.normalize("NFKC"), NFKC, "NFKC of " + nfkdStr); + + /* NFKD */ + assertEq(source.normalize("NFKD"), NFKD, "NFKD of " + sourceStr); + assertEq(NFC.normalize("NFKD"), NFKD, "NFKD of " + nfcStr); + assertEq(NFD.normalize("NFKD"), NFKD, "NFKD of " + nfdStr); + assertEq(NFKC.normalize("NFKD"), NFKD, "NFKD of " + nfkcStr); + assertEq(NFKD.normalize("NFKD"), NFKD, "NFKD of " + nfkdStr); +} From 645f8904ac1504e375d6196ac75ccd560f1e2cb3 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Thu, 5 Feb 2015 22:54:56 -0800 Subject: [PATCH 032/115] Bug 1133279 - Remove nonstandard let blocks from toolkit/mozapps/extensions. r=Mossop --- .../test/browser/cancelCompatCheck.sjs | 15 +++++----- .../extensions/test/xpcshell/head_addons.js | 28 +++++++++---------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/toolkit/mozapps/extensions/test/browser/cancelCompatCheck.sjs b/toolkit/mozapps/extensions/test/browser/cancelCompatCheck.sjs index 51ac38427ca2..38bc25d08e28 100644 --- a/toolkit/mozapps/extensions/test/browser/cancelCompatCheck.sjs +++ b/toolkit/mozapps/extensions/test/browser/cancelCompatCheck.sjs @@ -30,14 +30,13 @@ function handleRequest(req, resp) { createInstance(Components.interfaces.nsITimer); timer.init(function sendFile() { dump("cancelCompatCheck: starting to send file\n"); - let (str = {}) { - let read = 0; - do { - // read as much as we can and put it in str.value - read = cstream.readString(0xffffffff, str); - resp.write(str.value); - } while (read != 0); - } + let str = {}; + let read = 0; + do { + // read as much as we can and put it in str.value + read = cstream.readString(0xffffffff, str); + resp.write(str.value); + } while (read != 0); cstream.close(); resp.finish(); }, delay, Components.interfaces.nsITimer.TYPE_ONE_SHOT); diff --git a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js index a56dcbb7f0ea..64c0c7b36cce 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js +++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js @@ -1575,14 +1575,13 @@ function interpolateAndServeFile(request, response) { fstream.init(file, -1, 0, 0); cstream.init(fstream, "UTF-8", 0, 0); - let (str = {}) { - let read = 0; - do { - // read as much as we can and put it in str.value - read = cstream.readString(0xffffffff, str); - data += str.value; - } while (read != 0); - } + let str = {}; + let read = 0; + do { + // read as much as we can and put it in str.value + read = cstream.readString(0xffffffff, str); + data += str.value; + } while (read != 0); data = data.replace(/%PORT%/g, gPort); response.write(data); @@ -1654,13 +1653,12 @@ function loadFile(aFile) { createInstance(Components.interfaces.nsIConverterInputStream); fstream.init(aFile, -1, 0, 0); cstream.init(fstream, "UTF-8", 0, 0); - let (str = {}) { - let read = 0; - do { - read = cstream.readString(0xffffffff, str); // read as much as we can and put it in str.value - data += str.value; - } while (read != 0); - } + let str = {}; + let read = 0; + do { + read = cstream.readString(0xffffffff, str); // read as much as we can and put it in str.value + data += str.value; + } while (read != 0); cstream.close(); return data; } From 5ef9f4d21f9a10a96bac086ab9458d0b0ff30826 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Sat, 24 Jan 2015 23:48:22 -0800 Subject: [PATCH 033/115] Bug 1133283 - Remove nonstandard expression closures from security/manager/ssl/tests. r=keeler --- .../tests/mochitest/browser/browser_bug627234_perwindowpb.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/manager/ssl/tests/mochitest/browser/browser_bug627234_perwindowpb.js b/security/manager/ssl/tests/mochitest/browser/browser_bug627234_perwindowpb.js index c4b8a80855cc..3afc30f8ab22 100644 --- a/security/manager/ssl/tests/mochitest/browser/browser_bug627234_perwindowpb.js +++ b/security/manager/ssl/tests/mochitest/browser/browser_bug627234_perwindowpb.js @@ -61,7 +61,7 @@ function test() { // execute should only be called when need, like when you are opening // web pages on the test. If calling executeSoon() is not necesary, then // call whenNewWindowLoaded() instead of testOnWindow() on your test. - executeSoon(function() aCallback(aWin)); + executeSoon(function() { aCallback(aWin); }); }); }; From 16683aafd30a056a73158fd225ddfb7121bb89d7 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Sat, 24 Jan 2015 23:50:50 -0800 Subject: [PATCH 034/115] Bug 1133418 - Remove nonstandard expression closures from mobile/android. r=mfinkle --- mobile/android/components/LoginManagerPrompter.js | 2 +- mobile/android/modules/JNI.jsm | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mobile/android/components/LoginManagerPrompter.js b/mobile/android/components/LoginManagerPrompter.js index 33dbc49e8e8a..5394176e6ef7 100644 --- a/mobile/android/components/LoginManagerPrompter.js +++ b/mobile/android/components/LoginManagerPrompter.js @@ -261,7 +261,7 @@ LoginManagerPrompter.prototype = { promptToChangePasswordWithUsernames : function (logins, count, aNewLogin) { const buttonFlags = Ci.nsIPrompt.STD_YES_NO_BUTTONS; - var usernames = logins.map(function (l) l.username); + var usernames = logins.map(l => l.username); var dialogText = this._getLocalizedString("userSelectText"); var dialogTitle = this._getLocalizedString("passwordChangeTitle"); var selectedIndex = { value: null }; diff --git a/mobile/android/modules/JNI.jsm b/mobile/android/modules/JNI.jsm index bc2d41ae4a0b..1e10b9cfb2b5 100644 --- a/mobile/android/modules/JNI.jsm +++ b/mobile/android/modules/JNI.jsm @@ -797,7 +797,7 @@ var PREFIX = 'js#'; // this regex matches one component of a type signature: // any number of array modifiers, followed by either a // primitive type character or L; -var sigRegex = function() /\[*([VZBCSIJFD]|L([^.\/;]+(\/[^.\/;]+)*);)/g; +var sigRegex = () => /\[*([VZBCSIJFD]|L([^.\/;]+(\/[^.\/;]+)*);)/g; var ensureSig = function(classname_or_signature) { // convert a classname into a signature, // leaving unchanged signatures. We assume that @@ -1070,7 +1070,7 @@ function JNILoadClass(jenv, classSig, opt_props) { }); (props.static_methods || []).forEach(function(mtd) { var jmtd = jenvpp().GetStaticMethodID(jenv, jcls, mtd.name, mtd.sig); - var argctypes = mtd.sig.match(sigRegex()).map(function(s) sig2ctype(s)); + var argctypes = mtd.sig.match(sigRegex()).map(s => sig2ctype(s)); var returnSig = mtd.sig.substring(mtd.sig.indexOf(')')+1); var ty = sig2type(returnSig), nm = returnSig; var call = "CallStatic"+ty+"Method"; @@ -1090,7 +1090,7 @@ function JNILoadClass(jenv, classSig, opt_props) { (props.constructors || []).forEach(function(mtd) { mtd.name = ""; var jmtd = jenvpp().GetMethodID(jenv, jcls, mtd.name, mtd.sig); - var argctypes = mtd.sig.match(sigRegex()).map(function(s) sig2ctype(s)); + var argctypes = mtd.sig.match(sigRegex()).map(s => sig2ctype(s)); var returnSig = mtd.sig.substring(mtd.sig.indexOf(')')+1); r['new'] = overloadFunc('new'); @@ -1121,7 +1121,7 @@ function JNILoadClass(jenv, classSig, opt_props) { }); (props.methods || []).forEach(function(mtd) { var jmtd = jenvpp().GetMethodID(jenv, jcls, mtd.name, mtd.sig); - var argctypes = mtd.sig.match(sigRegex()).map(function(s) sig2ctype(s)); + var argctypes = mtd.sig.match(sigRegex()).map(s => sig2ctype(s)); var returnSig = mtd.sig.substring(mtd.sig.indexOf(')')+1); var ty = sig2type(returnSig), nm = returnSig; var call = "Call"+ty+"Method"; From 250218269a52988adcad7ae9f0cfbe0040ed071f Mon Sep 17 00:00:00 2001 From: Anthony Jones Date: Wed, 18 Feb 2015 19:13:14 +1300 Subject: [PATCH 035/115] Bug 1133572 - Remove duplication of logic from GetNextKeyframeTime(); r=cpearce --- media/libstagefright/binding/Index.cpp | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/media/libstagefright/binding/Index.cpp b/media/libstagefright/binding/Index.cpp index f81c3b1216ab..9a85b527d371 100644 --- a/media/libstagefright/binding/Index.cpp +++ b/media/libstagefright/binding/Index.cpp @@ -209,26 +209,15 @@ void SampleIterator::Seek(Microseconds aTime) Microseconds SampleIterator::GetNextKeyframeTime() { - nsTArray& moofs = mIndex->mMoofParser->Moofs(); - size_t sample = mCurrentSample + 1; - size_t moof = mCurrentMoof; - while (true) { - while (true) { - if (moof == moofs.Length()) { - return -1; - } - if (sample < moofs[moof].mIndex.Length()) { - break; - } - sample = 0; - ++moof; + SampleIterator itr(*this); + Sample* sample; + while (!!(sample = itr.Get())) { + if (sample->mSync) { + return sample->mCompositionRange.start; } - if (moofs[moof].mIndex[sample].mSync) { - return moofs[moof].mIndex[sample].mDecodeTime; - } - ++sample; + itr.Next(); } - MOZ_ASSERT(false); // should not be reached. + return -1; } Index::Index(const stagefright::Vector& aIndex, From 28c7d528c18ee6cf21974c190e0bddc444e97d05 Mon Sep 17 00:00:00 2001 From: Anthony Jones Date: Wed, 18 Feb 2015 19:13:15 +1300 Subject: [PATCH 036/115] Bug 1133572 - Use new demuxer for all sample fetches; r=cpearce --- dom/media/gtest/TestMP4Demuxer.cpp | 61 ------------------- dom/media/gtest/moz.build | 1 - dom/media/test/manifest.js | 23 ------- dom/media/test/mochitest.ini | 1 - dom/media/test/short-cenc.mp4 | Bin 14860 -> 0 bytes dom/media/test/short-cenc.xml | 37 ----------- media/libstagefright/binding/Index.cpp | 5 +- media/libstagefright/binding/mp4_demuxer.cpp | 8 +-- 8 files changed, 6 insertions(+), 130 deletions(-) delete mode 100644 dom/media/test/short-cenc.mp4 delete mode 100644 dom/media/test/short-cenc.xml diff --git a/dom/media/gtest/TestMP4Demuxer.cpp b/dom/media/gtest/TestMP4Demuxer.cpp index 786916962ba0..58278083b52c 100644 --- a/dom/media/gtest/TestMP4Demuxer.cpp +++ b/dom/media/gtest/TestMP4Demuxer.cpp @@ -87,67 +87,6 @@ ToCryptoString(CryptoSample& aCrypto) return res; } -TEST(MP4Demuxer, CENC) -{ - nsRefPtr b = new MP4DemuxerBinding("short-cenc.mp4"); - MonitorAutoLock mon(b->mMonitor); - MP4Demuxer* d = b->demuxer; - - EXPECT_TRUE(d->Init()); - - const char* video[] = { - "1 16 7e571d017e571d017e571d017e571d01 00000000000000000000000000000000 5,686 5,388", - "1 16 7e571d017e571d017e571d017e571d01 00000000000000000000000000000044 5,717", - "1 16 7e571d017e571d017e571d017e571d01 00000000000000000000000000000071 5,613", - "1 16 7e571d017e571d017e571d017e571d01 00000000000000000000000000000098 5,196", - "1 16 7e571d017e571d017e571d017e571d01 000000000000000000000000000000a5 5,213", - "1 16 7e571d017e571d017e571d017e571d01 000000000000000000000000000000b3 5,213", - "1 16 7e571d017e571d017e571d017e571d01 000000000000000000000000000000c1 5,384", - "1 16 7e571d017e571d017e571d017e571d01 000000000000000000000000000000d9 5,256", - "1 16 7e571d017e571d017e571d017e571d01 000000000000000000000000000000e9 5,245", - "1 16 7e571d017e571d017e571d017e571d01 000000000000000000000000000000f9 5,251", - }; - - MP4Sample* sample; - size_t i = 0; - while (!!(sample = d->DemuxVideoSample())) { - nsCString text = ToCryptoString(sample->crypto); - EXPECT_STREQ(video[i++], text.get()); - } - EXPECT_EQ(ArrayLength(video), i); - - const char* audio[] = { - "1 16 7e571d027e571d027e571d027e571d02 00000000000000000000000000000000 0,371", - "1 16 7e571d027e571d027e571d027e571d02 00000000000000000000000000000018 0,372", - "1 16 7e571d027e571d027e571d027e571d02 00000000000000000000000000000030 0,371", - "1 16 7e571d027e571d027e571d027e571d02 00000000000000000000000000000048 0,372", - "1 16 7e571d027e571d027e571d027e571d02 00000000000000000000000000000060 0,371", - "1 16 7e571d027e571d027e571d027e571d02 00000000000000000000000000000078 0,372", - "1 16 7e571d027e571d027e571d027e571d02 00000000000000000000000000000090 0,371", - "1 16 7e571d027e571d027e571d027e571d02 000000000000000000000000000000a8 0,372", - "1 16 7e571d027e571d027e571d027e571d02 000000000000000000000000000000c0 0,371", - "1 16 7e571d027e571d027e571d027e571d02 000000000000000000000000000000d8 0,372", - "1 16 7e571d027e571d027e571d027e571d02 000000000000000000000000000000f0 0,371", - "1 16 7e571d027e571d027e571d027e571d02 00000000000000000000000000000108 0,372", - "1 16 7e571d027e571d027e571d027e571d02 00000000000000000000000000000120 0,371", - "1 16 7e571d027e571d027e571d027e571d02 00000000000000000000000000000138 0,372", - "1 16 7e571d027e571d027e571d027e571d02 00000000000000000000000000000150 0,371", - "1 16 7e571d027e571d027e571d027e571d02 00000000000000000000000000000168 0,372", - "1 16 7e571d027e571d027e571d027e571d02 00000000000000000000000000000180 0,371", - "1 16 7e571d027e571d027e571d027e571d02 00000000000000000000000000000198 0,372", - "1 16 7e571d027e571d027e571d027e571d02 000000000000000000000000000001b0 0,371", - "1 16 7e571d027e571d027e571d027e571d02 000000000000000000000000000001c8 0,372", - "1 16 7e571d027e571d027e571d027e571d02 000000000000000000000000000001e0 0,371", - }; - - i = 0; - while (!!(sample = d->DemuxAudioSample())) { - nsCString text = ToCryptoString(sample->crypto); - EXPECT_STREQ(audio[i++], text.get()); - } - EXPECT_EQ(ArrayLength(audio), i); -} - TEST(MP4Demuxer, CENCFrag) { nsRefPtr b = new MP4DemuxerBinding("gizmo-frag.mp4"); diff --git a/dom/media/gtest/moz.build b/dom/media/gtest/moz.build index 57abae83265d..b0a0a222551d 100644 --- a/dom/media/gtest/moz.build +++ b/dom/media/gtest/moz.build @@ -25,7 +25,6 @@ if CONFIG['MOZ_WEBM_ENCODER']: TEST_HARNESS_FILES.gtest += [ '../test/gizmo-frag.mp4', '../test/gizmo.mp4', - '../test/short-cenc.mp4', 'dash_dashinit.mp4', 'mediasource_test.mp4', 'test.webm', diff --git a/dom/media/test/manifest.js b/dom/media/test/manifest.js index fffdd604c670..edca616fc12f 100644 --- a/dom/media/test/manifest.js +++ b/dom/media/test/manifest.js @@ -645,29 +645,6 @@ var gMetadataTests = [ // Test files for Encrypted Media Extensions var gEMETests = [ - { - name:"short-cenc.mp4", - type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"", - keys: { - // "keyid" : "key" - "7e571d017e571d017e571d017e571d01" : "7e5711117e5711117e5711117e571111", - "7e571d027e571d027e571d027e571d02" : "7e5722227e5722227e5722227e572222", - }, - sessionType:"temporary", - duration:0.47 - }, - { - name:"short-cenc.mp4", - type:"video/mp4; codecs=\"avc1.64000d,mp4a.40.2\"", - keys: { - // "keyid" : "key" - "7e571d017e571d017e571d017e571d01" : "7e5711117e5711117e5711117e571111", - "7e571d027e571d027e571d027e571d02" : "7e5722227e5722227e5722227e572222", - }, - sessionType:"temporary", - duration:0.47, - crossOrigin:true, - }, { name:"gizmo-frag-cencinit.mp4", fragments: [ "gizmo-frag-cencinit.mp4", "gizmo-frag-cenc1.m4s", "gizmo-frag-cenc2.m4s" ], diff --git a/dom/media/test/mochitest.ini b/dom/media/test/mochitest.ini index 6b4d59af5039..b74eb19699cc 100644 --- a/dom/media/test/mochitest.ini +++ b/dom/media/test/mochitest.ini @@ -233,7 +233,6 @@ support-files = seek_with_sound.ogg^headers^ sine.webm sine.webm^headers^ - short-cenc.mp4 short-video.ogv short-video.ogv^headers^ small-shot-mp3.mp4 diff --git a/dom/media/test/short-cenc.mp4 b/dom/media/test/short-cenc.mp4 deleted file mode 100644 index aa44c3b9a187b78c7a7a0a0bbfeb546f6ee3d96a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14860 zcmb_@1yG#Hx9{NY?(Xgo+$FfXyF0-lxCIXccXtc!5Ii^p3+@mI?r+HM-n+Z^pIh%$ zy;IfS>HeKxpYGFg=Bue0002O2?&|4i<>Fum0DuBsHL$Q6xtp-qIkK|=0I=0|4i4@B z0KnGH-O?1O|0ZDj002k}00j8_8~V=%(C`l<03h^t?*FWV0RZ69uFgg_K$EVk&95<$ zUTKrU+%Q1(r#Fz?SL`41uW|lj{>2djRzO}KXTSmgkeivhx&Sr4nXQZKFXWf+SHIwY zjsgyDXKG~xv=Q5x{&(zu%!3&SqXX3XfAwUrG_`g9(+9xa%GB(y`m0t4wjHF5>`iUW zUO8aZc2@T0zzVv%-7lwqpEkMaA2xhbXR}w%tGwFb-JETS|EPmGxVReI0_%q^t}cIV z$SY^b%--a6qh96jKK}rOfMH7ktFPr%{s-d^_-{|_mlt4*9e5N(K}-P%FBW3J4LqzGA-w1ldo60Oaol2xGgr{@SWn#_POcUymwKG)?{+e?1yN5V&=} zI6%rT{a5?7`P%naKcN0!?dZUjeLWhl@;csY!3Sc0&hfvnS0}GFKA_DDsQ(fm4$cQ0 zYZ_Rrf#5K(Ed5bHLV#T$fc5)7x&qh5)x-hVewEjGEdVvWi-n`b10|)f~3orZ=pZgbH{~NsL z4;&=mU;J->;{SpH2Y>px`j_GEPy7J@fPnd5a?!8T1dPAsZ~Z}DcL3P`pYpG^&_Aue z%SAxHkV1d>0uTIsE~*d%0F;IPQ!a9GaI^pWP%6N->3`=UaQZ)U5wgo4x#%zM|4kk` z`!f%f|0@rr15b_7pN{@JY)}C5EA~27pir5)nEtw9U^u`l363I!@rr^xC%qO3P*h|{ zkk_^SM{QuPdP6&94z_I_ggz#VSy~g@0hX0um{)z$T-w6R5*x}Xqn=}9o%-o>R ze@g?e+<(fi9e!Pae+c%kCHu8F|G=65#Q)8g`VHUkH~e?M;m7@kU-BD%_iy-%zu}+# zXFdq@f98V_|Ax=~8@}Ri_?Exn2mFSg`Wt@DZ}>yM;jjOVZ|r93`g#Gi?aY4Z*Nr9l z`-=}SK{*>aI=;S}{Fg9T{qc51QR?dO`Z+^jYV@n~uVW)?SR8 zxLCegkUf4Jch|{*R&4PRDsMi#1wyaK{2%WHf4|y)9(^E<@!k$N0+3z}Nd=zW%j{Lh zW*KVWk+P1AS{tQTZ&|*pu^xhQiA;OumLCxl0VGPXOdy8vDkN1x1XnL$-&r4wDr3Ik_7B?< zCWtMTh7bs8dQbgruJsOUSqc|({tJEM7%!MC-ZerZ%eY;iWjXhaV&Q?P6HnT6O(0b5 z*pAiX0bV;yd${{}yj+IBq6BEC0#}m~0FZ;5JLR67yjZHf`WZNpDaBl;gA?os` zi5bh?GLOD6%&Hc0wf6zld({*jY8 z^c^s(>GiIN3{~*WFjD{-8Y(pWo6vic-l>*=g8?3gnu_VxOE*rQSQpD(*sn&`sSnQx z(jpb~jsfF|So6^g@wsZF4bx9BdT0-4PLP39+5+c+f^EPO^_;ZmpZk z4o%Q}YV(SHF#2|dxH7YpHy#0G8jQ>v5Wz1Y;fG<9I>oiMPSPwIcCKPrP%oF8yP{}B zWTZEl=p_ZRka!hLp4e}tqe5Ltd zgP;5TaX`-0Wa7JpiAL}+Qxn`5Tc>*{y?#gcK@a*5Hsw#P8(9RRFR(I7<;;=0DXp;w z3CpUWD*-yrvO(qW0W~go)97PzJPs<$9$Q&+hmGy7>PZ;IV)fQhw6*dn0DrD?1mfO==Xf^)?&d{gIq|XSK2O$r7edl7m{+2%Q3iG6Z+oRQ^aa?O2{r^ zA`EHZSo9hv(Y(WA%P+G8kzAqY&P}C5rGb8J!H928u zX09O6H+&n&U}t8{BQJuAdyF0sqGE#rRm09PTcC<7#B_8w0Ew`8<_SSjmC zq2)s`X)crQ!g5a_heG1u((zML4BUa@vSanZK6_1S9dDMHthFW?Ou>J5bFYRF zTg?rQT)?%E^~*v|(l<@M>1?9t?Th>&TRL9{1WQ-Ufz$z|=co0t5w?sloxB&0!V7b4w6^3_iE9KTm=g^d z^t&2ya(%Jq+S&15Jkgpxtv)cNlh14u>6>ZttVLG|F z%W}T6T}~s3UUKSEGw%`E3M+hshKHpQS)<<#J@Gi~ZyoES4(LIllFLM&tDX_m9tJ$5 z6&C-P-@eskHDo1Bm7 zyzCs$epqode)CbBNxA{oY*$Xmii=AQ1FK!(iC?Yk_tFU3K8HU6TtQTckazuns7&3Xc z)5_Xbb`e?F5u~`MVE?_D0_2$60b&R^ruc>X0=P)c~Rs=5c#PkTRajuW3jeX>BEGdaB#`;_F zh`xEmOJ#yXJ}sx@Wf-f|yPx3FuWKaxNF|+mmXYedFg4l;zFa%+qzCRNJu+w~vG_ki z(imo7uTC7`FxN?HyaeSS-lx0?iF1EXm{uEzt$3APu@qw01tQwUPGI5A7>!^WO-JOp zknI$b#t4?vs&je+qMR43K}P18CKU^SS8Bs~Mb5Dypxh zLl}ENL&{utOQ;QF%pYe1^X_Q3LWuU0Z_>q+=R<86t146i6PYWYvy%4qG-KF<8%|~% ze$*6lN)X&~?uJK-#7$%X75~IOHrjRTf;!0vd;uE}E_oZ0uOi1Wkd*ep?UC&TJ+!s` zWZhDJyMROK_GPCe9;brj1aoe6|7C*`Or+MqW$o*a-k$L*DPgXN0ft4&X+o=1L?!ao zxV^}2^v7V6m$mb{6g>fh<<)Iy8SGkWZ`1x7(P@f61Pkd?OH6FRv(ni+ZE$98T@Ln) z{wYnlf$W852Z|a(6ttDKb%u7oM_CWyQsO*{AM_O7TF}<%wVB*T%J`QxfiOZU%*n8P zA4CD2dwe|LXhtLhM@FFrn4yTo{ z(0c$P{lh{o(yY5$`_==-Ojd|=BDwu}^$lV?y8OU2Gj(}+^dx8#kko&|gqzrF+C?f3 zJ@;T>8W>uF#F{zVuik!eBd)~Gh8HO2i_Vjg#*)!Ojhw=D4`Nt` zpn*mFaHB-QX!Q92mAq$0;Yp?1=88b`Yg~N^@GfkLUy&^7v6Q}nv_?jH@QN@!m#*J(1>)$?4d>Fh(A5F zY1wCoM741m5Y#I}jtV{V;*N96Xb2Otm}xuhb$_rFX$-4~$Vk*KM^5#GBTlaUv3a~y z|9Mj4drjw?-1P)@)mnP#GyiTUXfYMmULGRG<&d8r+?E+yN{Qgu4|T<~JI#w=Py3Y8 zopPu_4W684)l5u!aEYa^92WG8`vNBHr`a0JvKm6cD|(dA>!k(PO?;FIWvZa!a5d~7y>TA=lyHS z2d{#j*9GLgc~;(tx}OSS3Uvm~jFt@(gsnXU1x0OsnQzvGX#w%s6qA+hAHAHh5DT3u zui2kZYCa~6%Xyc_$oFGq&vpsqWNKT>phy2FC{$e_+S`mg;RmeZ@kRyEfCh)|iSA;# zu4lK{oA7B-e2x!3coD;(#sN|l>a4IQH&#m6@@fK~ct9Hswx~`fY!gnuNk{U*T=0^& z_m9HA^XII#k~Gd*2}7)=(C)%D9SC2P11tIoy=BdYIzZ@rEWuLgRZtM1DjiFo3}N>!pFdt-E6$r{mvFHf+D+IASGV@A>!VK5oN z+{Fu4Qk|v2P2TuxXouh0bAqyD)W2K8?shwAHgu6fzDz@GNIGesiraRiyx8mE2vK<( z5abgkZGfiG5fO&xR>yru=?R$#yDqaHkf+JzQ5j126llo!JeEbiQ{?;}kSSc>-{n=s zz1o}>5p&y`9#KiI;{z0TP>9i2^jycsVWzmsaIAJZpr zXr9@-1pe$Pp4DN5RTJiDr@M>GsT6{lUx+0w?u|QFi;SaG+&k3WFmRU9gJ!Ks;Fq#b z&?I9^?vs@VI9ro2omp1TxKPqlr!A68bu%GeGvf6}KXH8UoaJIQqxtq3p9*vnN`5@y z<*uX33$t8GcgWU}t^<6Go?3MtKH>$wV4x-+S~O{o>QtUUbrPmGr8ZJN^5b=7I!GxF z`0cXeUiVaN@Y3D>TAT`*CaPPFlTA=yRyZYtd7^>5{NURL!BVBk&fF3v=?T%*wl#MX zaN+2izmk9MU71@K!=5d6 zG(hIu0rSyaT^wrvTJ`|P9kKN zYa!R^o$brU>RJ&ZFs)7hb#-=zy6#j73<-}4ENp1hFa6tQ70g7@XGCn^?x3REjyc7c zS%2Ag<9qh$Dpg!;xBw8u-EDe6VQZk=iDT)>jAymorAPEc8X9emlq^x79Y|sxT+r?^ zCEw>lIPB*;A>EHiSYtaL2Wd+vbUltWbObMOuTEEZ66oWGyUTO6+`x>HrhhV;l(ge* z(VO;!G{NLtl|y*jVmK=nqQV^?H*-nPT1`Zl5}nRYZM_OHOuCG@H)VTMv9_%3P~UCC zNbut^@@p_1S*=eIz@ct9_+AJ$NyRsW-2Hfs*lKCt*HPq~c^ZPx`CpS_DdRc}rz^%=v4Xsv7n}gVKbp+|{)T{tb^ugdgCF zsJaTHC)dPSMEe}5wr9H=-*O`vs;N)%ctQ>Xf50X~2!8BDJX3H;4wm%|PkmzNZAhqP zgHPq2s0KR@&LK#tK2J~b*E-bd>GZtANc+NJw#eAdKx<-I8h7TivSOV3?1|b+oq78V z-VOEskg=40!y=symTPEss+2%`XTea0$#QY<4MPdFuAG1|oEYf7Rd5x!k4S=3j%n!x z$0fV>c2M85HUbl@YWlaRycON`yX*D3He)f6TBHuVxQS>DtlayO_zi4 zBrLk0ZPSfOeN9;xG%p2euD|tt&Yg?Vy-$G4EW*JIf$L%W&b4(-y zgc%V+zRlYH5seA?$n!mwFj87A>&K@LKUrUvIaRXK&DU{E6t8mQ`pP1e+nXTltMQgu zCBa;qdxeOzyA;H9;`%mmzlOw)zle*NQf`!pZ6ICm?>2pYDmlVlS~PKKT@7Z2+RgbH z7APf(dY2w$??C5ihV%l>I+`& z1d{{kCnCg$ZN1WlHwC?ZH&T<-K8e+LBh&)C@lHp2-ockBr=0e|O3?ilZt12T47qhs z&9=FA6IYh?AEYmfH_3haxGAcTmVWcUt{}X>=@4BfwzO&ODn8dRGnyns+ zHtRE(=Fy@@g>TNGY(>jc;=luEHFuT%CLLkhN?ue=shV?^bTHR>UD)x*BwyYy&(bOh zZbKlY?rJb|tC_iLZp~^$cdH^xT7-sZlFWKvOX#+=5NoE_hp~gO-%>GzoU2;0_;uxI zabbb#naGDPNpoS+|OmCoJ5SPwb*o*)MLA23@yf82iAPLJSIeA6q!=ESmA^PtHvCu&bhEx?w^AD!2X#ijTa%<(2ODFN>343Ss+Otu~; zt!h>*crC-(K)>iEy(c}-Cq9cRP$Br~L=l{L|{r40|52fkmeFehg8H$y(SgZR)XTW9*>V{cu1 zI@wrh>zttRkg#Xa*W-!SPg%rshaQmdeJP{u?BK*xzwf3ri}{FZ3qd@2YR|R<{3f#c z@K_f2%{{TrMO1KSs3(bU;Uo3k4kI^$2Grsug)zG7R|yl!O1ABx@5JboF;MQ{!Dsn3 zSV}^2!#i3O6_VSjDO1O%@NmJEl~xrlgVLgFJ@;~ji=Rc%t0`C|al0rDxoM&)jHW8O zTic8}3N`x_&+LXrE$4eWy&Q*QdU-i64FnkF#RD&+z_bO$9OI57lIBAz-RcGg7D&8f zGT}w|1cI>e*yH;_KW{Fv13b4l+_v>5^!PKzQmHJZN0*n}SiXC7m4FE`45Yf(2woU* zU%)2_E{Id(bbV+uWplyXQMMgvNBYK?3aj8+3ynJEt-0<3D-7`v1L$@Zv7pF^VdjV& zOD>;W;_o*6GBK%sSgeylx1W7K>=^rHscI6XF2HW{5_ao}BRaUllg@?HfV8a@BJGEE z!b?QO8BysQx{koKENvE0j1QgR5djx5ON6)G+GSadB7k112i@VKXl&l{OnszR{$ig&v$nTWSyT*HrIU=q1H3p-rpf>kJEk}?C1hSWaQH>&!d(qU z^KJDyOpQGQ7e5JONMIOnTUX0k3-Zh_of(UDXB$*J24dBqf<()S^W|40kW{Y%(*1W0Bm}-+?0ST_Zm2 z_%t6dytqRl$5Eiu&P23%LE}8+e5|jV*Fwdy@EG<1ib_BoDaplg`i`RIEXjGX=S@4Z zENJa>NG}HTR{$irXI(`qTcrjlJwdBcvD6+8fCJLtIvy`M5< zsB0`UiVby>pD@dQZZ^2vyr4|OL@3lVDtH+C8b4XWnroHXjDk9hv_#l;vhOoTvzi!9 zSqoqP+2C41_Lv5?)mrcD=OckCcOU1OkDJ)=>4Vfe#(>nR-p}zmy}^i1*_XU~a*Wa@ zc-%7PI7#h$WYUK0Xay6U)3T3*{$N?6(yQ7T%`d5`szjls#v}V1VbQ83U21Hf)NO~v z6G+}>Avd`3D4J0=Dn6dGPeKg@^5mk?&|AMqjDo0&)|V-VROHWGs&bg@(8!2QBPO7V zKIfAZo&k4=N7U z4!tAEkcYqvAr;M|i22vqmU?n6XnQAIy)As2njtvOc z3fk9Lp9X73Ujj%dc9HY-%MH~DMJ#LY0m1Na@h48F+uycsc!5)tKV#~N-uq#bU5KYP&G+e>czF)Qwt zf1rk1i6JN_CnFX93(74d?eI|L4bV5G4L$BKDUq-$h?=jNiCnw?*VZPx*Vq;0(st zl0RW&(VvOU(t;t@C-W=oe?5PIY26|AAGKhDQ^GWW(ePLNY5zFVBkF=7jLN1iq-TiK zK(-Wb8gT1rj(`dkFLakL+*L99DTKf)4WH<_mXqwR5Z(h`t|#v!PK@Xe1XEO!aT2EU zWUVS*!uM@(8gR3kshuw2Gh--`VyRu7+`1!)wQu3KGL6mGyyt&dYJelutdeYmA?Y4@ zgnJ0U4tIpFx*T3K7JG402W^t0cfBDYLLmIXV;hG1V}0<7#Ldac#=Q=@PNrM{Q*8?q z`@2_zMXNjFm1!dda!I|YA@6;BoM1sNc4AP89V>Km10SIf==E%tS~A!fJDop?LCDsc zD7KW80TOMar9{;YV#Kv4n@(C#nmila#dj?5ve)tS^*<8ewk2! zQk}OEXz(9KG|L_KTYE^w6pLBC1kuJK%0)a-KKq6W;ou$JpspL2^$(cF(S$U`C#n&# z@2(WIgW6COC<;W8RHtdC3YGg(=REaQ{)fug}z0N1bYKTviT^0T@u%hV;AeZ~vl;EO~$b9kC zf{?OYw2BcC(F_y54x9`R6cPtFzH5x3pI^R4kT`iB?Vm#1k>q_sA?z(P?7~9Br+}#a z_I0!yw^+LWFdZ>3pWoeKSRdzso1kyIt6;0cR#99`9PC;0oxTjHBm$&i#me{f2;s1P zR4VNjiz)_#mmjM?c{eO~Y{j1xj95V{V87)fvE9|!t(M)xkVMhYJhgtKh_9VdQ$v!F zRrODv%_19fki=)-W;)9gG=~oer-TlJeMA-@6x%OXoB1->1*kjdUxSu?jApHD>LeQ+ zYLX1FQ;*%a9cvPb!%)XfDl7_*%$3UNIur}GAgg5j!b|u@i{Iu21r8zI-!lU~MR+Yz z_b0S$CkY5>4(FdwXk8a*b7IklmbE$XmvdtX_JdTfrttMb^mKvYwJ)&V)Ohd%rYPTk z);*T4@!AdxL>>_1HRKVpi+D1<<}{o4p`Yv_ZGpe5UyCFw;)*VbQ0qdJ7|8JDUg0hf z5hK~mLRaq1301_vsf!rnpG_BhwyF*`V_=>*=+{I*8Z2RbqCX~9XCVq+)2qkM0jCr4 zv!_;-f`q8pnPcOtYKW1x>3H6AuWvB;Aeo&J1iu6Je5ph<=~(tcfwN!`PpcdvY#iX9~<~($)VmV6WdEA{~Ev}S|6*}`n`X;d_9n2v=wBw1{ zNl&c6iZV&C_FMr@ibex0sogF0A36QI*~`Y`;BweIje={y)-T=a@?oBHNk8E$YUIR9 z)2k4Z-PK)7hBm*C6ulky1f>Q0&Zz`LLdki>D!l)$f|>^^7`MYj)3j@Bv!erV%HrjDm=Hd~xXij* z{zCWRll-fpk_D4obp3||Tvuet30n@^`OZ9SI-^cpmSE4in-=C0{ktwUQ}biUQI~DK zVITKcgzK~9+UQfX^N^<+^W-)pp{>MFZrDm}|G))!v5r*3xJN&3hi9-UOW7Kz{F`FR zI>(SnbBNuiq0gRmLlJ@@RCxxEB}2gh9CP{Q*qUz;5iWE>-!fY0p$qYYl>ZGg52qa@Ca zll*WGmp4IIO-Y(3(O0GX(9>3jCb2j%aY)0JPj;kU)!K0yg1)1DkHENZirq6y(VIa5 zuh+=v{BY6|8SSQ%EWBTFGw9JS79;7S8Zu1zgE~!PowxWi!(AF@(fpvE94BkO+V0qQ zL@EVh4bXF0S=ER-*yDX}P zs|Sf7Z83HN6)HxnP46*#Mg^C>8mwFjgh z-$jNk#j3};_$CBDYzDV4z13_+EdPvO7fa@+_r93E9tI}7FT|2fPJYu%@H%inw{{yTZnJS!|%)8=MFeuCw0!iJFN4qmD&qu zS){e`eHJ6tlvrhIqL2Y+w@9eG;oL)4{kfZ5yLa8Z0^YqpAMnP#K-f-+=y7%a_Vs27C|#-ZbLFz1@N5u>Q*-j2^`_>~Z_q;Q<* zdF*nGwr3f#3BRCe9~VB%g8?~T8D7mBQhP4UnVd1Vmumh zYf6cZOhrVHOW|Ysu(6<|jisSYcThfFc{5Rib&G)#Cd4VN=a>3^3ZoJ1(NBM3y?uNW zv2S}&-VoW16q|Pg6ILmU0OuokEKW7vv3brxVecKmcYMzQ$n~>0C#FtmnseH888*pC z2jlb@0$1N_(vX(f)X@}UG3&Iexb z6D$uBNp+#vuGFaML>B8BiAgvqUOt|i7)$PLSK>_;r?t}s;;prNM?5IbL`B5hRC?R? z2JHvBb%cW86u#Sn+nA?gzFn+9*J1LrUFgrara>>1t2-DLC<w8l^Gp@{JYaT<-uJWpE{ zDV6n@FK7&RO3`;&6P!xtXUlM{4VL-!$eXc7y$1IS?EU!bQkXbIDEOAv)L_SSmOn-X zIs_DvBfD&?Z5;pLN7N=9VYOnoX_lWj(@vbZ2;d8t_*U6PCDn{T^N}&`)6(unoUokA z5s^#Y_+T^%%Q_P`%^c4d)tNXVN0p!KQ!*-Mfv|vy%;K?ZJS@k-Zx--Pr=x%W zu0C=2ImO`3XxC@d?Do|gSc!BS{~vk|sj@>xP5u(G5YJ1( zm#H?6@OuC~T)S|$`on@5=R;DM4zYRF4%E4rrpW_~l&^u~209fn#@qs4()wR?qEAO| z3o0>TA1{>s8Cif_lv-eN)$9$@yfH z)XT5FM$sEq*jXVn9;eXxmEsdBtFPVzVY$D?u>>Zauxz-~D3^-ujOKkEOjqzp(XzU% zEAfzwyq?kJtQHQQdEea-{rW0zmn{p8Z0duS1PYqu9Z~c?cc!jZjXS%37~Z9NBU2vP z$O7Wxbts+x0`43Xo2*USt^NJXdwek@WV6b|K-eRK1t*J~yRkGW7Mky#p!OmKwJ-zS+?|&fe-?|Cr`H=mHAfJ~?D`gXh zXKF2aCldV4nh8r@A?R4VLv57KXz#QzisSJzHC{SbJp6LY)fn@Ke$1APUWt}iQweNm zcIPqU;9F1k#F#`KNS3*)#HJS79Tfd#3~MK8!uG5ut^AAx@xc<^P#1e$MzJlJN&y-K zvrdBs6RS%dLr%n`^~Ctm#-5C*E2D$As9iSS{ZwbgEhx`PClYSFttjMh`X~wxS6E?s zs8hsdQ&!Dqa`)bgKA}f7u57OB!{wpGCqlE*CU(5w+KUhZ12OgB!5dq z!lX6%!#IcM>fG?rUGSyEIo>IvS*$AKfk>8TM<(3dRWd>UGlgqz3aj$R)gT?zd^U|p z&q~(I_s4lF z%33=hU+64b;qIv*;K#}RHHbD_1UR-rfnFk0+2cKpBhiDhVqF}$AMZ;>aE)W)VI6kG zEp)E_bAcXl!s(y@-B5lX5yA3u)#j-9 zX#9d(id?f@I))!f{iy?0UL%;Fha7j32o$2 z*Eec_9_ifBRcU>g4O<}W$WL8<*Sv~*q~F#|yIew2xX@nvQlZM20XMV2g{0_dUnn94 zg;WiL|E)Hq)Wo3e{YpEawu$D;xe>U(5@b?OZ!1PYg%9 zfL3qNH_<*1&?lr6^AF<+^fZMp+0fQa@+WaxZc8R}mC_SKum7ThHg`6A{bLpHtCn_g zkTV1Rd68Jc%GQin(b>V&&BV-<*u%=zl2}qvSd^HV5%|M<1~GAU24^#Oc4kfv!2bb< Cx|JvZ diff --git a/dom/media/test/short-cenc.xml b/dom/media/test/short-cenc.xml deleted file mode 100644 index 9658c3e32ffb..000000000000 --- a/dom/media/test/short-cenc.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/media/libstagefright/binding/Index.cpp b/media/libstagefright/binding/Index.cpp index 9a85b527d371..a74a5acaed5d 100644 --- a/media/libstagefright/binding/Index.cpp +++ b/media/libstagefright/binding/Index.cpp @@ -157,7 +157,10 @@ MP4Sample* SampleIterator::GetNext() Sample* SampleIterator::Get() { if (!mIndex->mMoofParser) { - return nullptr; + MOZ_ASSERT(!mCurrentMoof); + return mCurrentSample < mIndex->mIndex.Length() + ? &mIndex->mIndex[mCurrentSample] + : nullptr; } nsTArray& moofs = mIndex->mMoofParser->Moofs(); diff --git a/media/libstagefright/binding/mp4_demuxer.cpp b/media/libstagefright/binding/mp4_demuxer.cpp index f940a862b5bc..64982b59d00b 100644 --- a/media/libstagefright/binding/mp4_demuxer.cpp +++ b/media/libstagefright/binding/mp4_demuxer.cpp @@ -124,9 +124,7 @@ MP4Demuxer::Init() mSource, mAudioConfig.mTrackId, mMonitor); mPrivate->mIndexes.AppendElement(index); - if (index->IsFragmented()) { - mPrivate->mAudioIterator = new SampleIterator(index); - } + mPrivate->mAudioIterator = new SampleIterator(index); } else if (!mPrivate->mVideo.get() && !strncmp(mimeType, "video/", 6)) { sp track = e->getTrack(i); if (track->start() != OK) { @@ -138,9 +136,7 @@ MP4Demuxer::Init() mSource, mVideoConfig.mTrackId, mMonitor); mPrivate->mIndexes.AppendElement(index); - if (index->IsFragmented()) { - mPrivate->mVideoIterator = new SampleIterator(index); - } + mPrivate->mVideoIterator = new SampleIterator(index); } } sp metaData = e->getMetaData(); From 8b68b8e3e85d1861d7cbedacff2a7db35c386850 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 17 Feb 2015 22:27:53 -0800 Subject: [PATCH 037/115] Add weak reference support to nsBaseWidget. (bug 1133150, r=roc) --- widget/PuppetWidget.cpp | 4 +--- widget/PuppetWidget.h | 4 +--- widget/gonk/nsWindow.cpp | 2 +- widget/gonk/nsWindow.h | 3 +-- widget/gtk/nsWindow.cpp | 5 ++--- widget/gtk/nsWindow.h | 3 +-- widget/nsBaseWidget.cpp | 6 ++---- widget/nsBaseWidget.h | 3 ++- widget/qt/nsWindow.cpp | 6 ++---- widget/qt/nsWindow.h | 5 +---- widget/windows/nsWindow.cpp | 4 ++-- 11 files changed, 16 insertions(+), 29 deletions(-) diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp index af6ee5f8b276..1140f7b3bb16 100644 --- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -67,12 +67,10 @@ MightNeedIMEFocus(const nsWidgetInitData* aInitData) #endif } - // Arbitrary, fungible. const size_t PuppetWidget::kMaxDimension = 4000; -NS_IMPL_ISUPPORTS_INHERITED(PuppetWidget, nsBaseWidget, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS_INHERITED0(PuppetWidget, nsBaseWidget) PuppetWidget::PuppetWidget(TabChild* aTabChild) : mTabChild(aTabChild) diff --git a/widget/PuppetWidget.h b/widget/PuppetWidget.h index 6d4bf5f22074..db3b7ed1ec83 100644 --- a/widget/PuppetWidget.h +++ b/widget/PuppetWidget.h @@ -21,7 +21,6 @@ #include "nsBaseWidget.h" #include "nsIScreenManager.h" #include "nsThreadUtils.h" -#include "nsWeakReference.h" #include "mozilla/Attributes.h" #include "mozilla/EventForwards.h" @@ -37,8 +36,7 @@ namespace widget { struct AutoCacheNativeKeyCommands; -class PuppetWidget : public nsBaseWidget, - public nsSupportsWeakReference +class PuppetWidget : public nsBaseWidget { typedef mozilla::dom::TabChild TabChild; typedef mozilla::gfx::DrawTarget DrawTarget; diff --git a/widget/gonk/nsWindow.cpp b/widget/gonk/nsWindow.cpp index 38e580fcbe50..509dc5b05d59 100644 --- a/widget/gonk/nsWindow.cpp +++ b/widget/gonk/nsWindow.cpp @@ -129,7 +129,7 @@ displayEnabledCallback(bool enabled) } // anonymous namespace -NS_IMPL_ISUPPORTS_INHERITED(nsWindow, nsBaseWidget, nsISupportsWeakReference) +NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, nsBaseWidget) nsWindow::nsWindow() { diff --git a/widget/gonk/nsWindow.h b/widget/gonk/nsWindow.h index 5c6889bca6f9..4ef7b3286c03 100644 --- a/widget/gonk/nsWindow.h +++ b/widget/gonk/nsWindow.h @@ -19,7 +19,6 @@ #include "InputData.h" #include "nsBaseWidget.h" #include "nsRegion.h" -#include "nsWeakReference.h" #include "nsIIdleServiceInternal.h" #include "Units.h" @@ -45,7 +44,7 @@ struct InputContext; struct InputContextAction; } -class nsWindow : public nsBaseWidget, public nsSupportsWeakReference +class nsWindow : public nsBaseWidget { public: nsWindow(); diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index 82fe613a6fd5..dd1895b855e6 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -345,6 +345,8 @@ UpdateLastInputEventTime(void *aGdkEvent) sLastUserInputTime = timestamp; } +NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, nsBaseWidget) + nsWindow::nsWindow() { mIsTopLevel = false; @@ -423,9 +425,6 @@ nsWindow::ReleaseGlobals() } } -NS_IMPL_ISUPPORTS_INHERITED(nsWindow, nsBaseWidget, - nsISupportsWeakReference) - void nsWindow::CommonCreate(nsIWidget *aParent, bool aListenForResizes) { diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h index bc7b992f5fb9..fa4e113707f4 100644 --- a/widget/gtk/nsWindow.h +++ b/widget/gtk/nsWindow.h @@ -13,7 +13,6 @@ #include "nsAutoPtr.h" #include "mozcontainer.h" -#include "nsWeakReference.h" #include "nsIDragService.h" #include "nsITimer.h" @@ -68,7 +67,7 @@ class nsPluginNativeWindowGtk; class nsShmImage; #endif -class nsWindow : public nsBaseWidget, public nsSupportsWeakReference +class nsWindow : public nsBaseWidget { public: nsWindow(); diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index e09f301a8eb8..89bbe74a3a21 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -94,10 +94,6 @@ bool gDisableNativeTheme = false; #define TOUCH_INJECT_LONG_TAP_DEFAULT_MSEC 1500 int32_t nsIWidget::sPointerIdCounter = 0; -// nsBaseWidget -NS_IMPL_ISUPPORTS(nsBaseWidget, nsIWidget) - - nsAutoRollup::nsAutoRollup() { // remember if mLastRollup was null, and only clear it upon destruction @@ -113,6 +109,8 @@ nsAutoRollup::~nsAutoRollup() } } +NS_IMPL_ISUPPORTS(nsBaseWidget, nsIWidget, nsISupportsWeakReference) + //------------------------------------------------------------------------- // // nsBaseWidget constructor diff --git a/widget/nsBaseWidget.h b/widget/nsBaseWidget.h index 840ff1f9d6d6..485af8c071ad 100644 --- a/widget/nsBaseWidget.h +++ b/widget/nsBaseWidget.h @@ -18,6 +18,7 @@ #include "nsIObserver.h" #include "nsIWidgetListener.h" #include "nsPIDOMWindow.h" +#include "nsWeakReference.h" #include class nsIContent; class nsAutoRollup; @@ -79,7 +80,7 @@ public: * class, but it gives them a head start.) */ -class nsBaseWidget : public nsIWidget +class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference { friend class nsAutoRollup; diff --git a/widget/qt/nsWindow.cpp b/widget/qt/nsWindow.cpp index 773cdb377445..b5572f452d3e 100644 --- a/widget/qt/nsWindow.cpp +++ b/widget/qt/nsWindow.cpp @@ -89,6 +89,8 @@ static bool sAltGrModifier = false; static void find_first_visible_parent(QWindow* aItem, QWindow*& aVisibleItem); static bool is_mouse_in_window (MozQWidget* aWindow, double aMouseX, double aMouseY); +NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, nsBaseWidget) + nsWindow::nsWindow() { LOG(("%s [%p]\n", __PRETTY_FUNCTION__, (void *)this)); @@ -1377,10 +1379,6 @@ nsWindow::DispatchResizeEvent(nsIntRect &aRect, nsEventStatus &aStatus) ///////////////////////////////////// OLD GECKO ECENTS need to Sort /////////////////// -NS_IMPL_ISUPPORTS_INHERITED(nsWindow, nsBaseWidget, nsISupportsWeakReference) - - - void nsWindow::ClearCachedResources() { diff --git a/widget/qt/nsWindow.h b/widget/qt/nsWindow.h index 206732742371..964852db87b4 100644 --- a/widget/qt/nsWindow.h +++ b/widget/qt/nsWindow.h @@ -14,8 +14,6 @@ #include "nsBaseWidget.h" #include "mozilla/EventForwards.h" -#include "nsWeakReference.h" - #include "nsGkAtoms.h" #include "nsIIdleServiceInternal.h" #include "nsIRunnable.h" @@ -77,8 +75,7 @@ class QWheelEvent; namespace mozilla { namespace widget { class MozQWidget; -class nsWindow : public nsBaseWidget, - public nsSupportsWeakReference +class nsWindow : public nsBaseWidget { public: nsWindow(); diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 34cfc3713238..a28038cce64b 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -4332,9 +4332,9 @@ LRESULT CALLBACK nsWindow::WindowProcInternal(HWND hWnd, UINT msg, WPARAM wParam // Hold the window for the life of this method, in case it gets // destroyed during processing, unless we're in the dtor already. - nsCOMPtr kungFuDeathGrip; + nsCOMPtr kungFuDeathGrip; if (!targetWindow->mInDtor) - kungFuDeathGrip = do_QueryInterface((nsBaseWidget*)targetWindow); + kungFuDeathGrip = targetWindow; targetWindow->IPCWindowProcHandler(msg, wParam, lParam); From c232a70058ba0aca951528f92e2e1bf9edcd156c Mon Sep 17 00:00:00 2001 From: "Kevin K." Date: Tue, 17 Feb 2015 22:10:03 -0500 Subject: [PATCH 038/115] Bug 1057600 - Don't require MOZILLA_OFFICIAL to include build revisions in build. Add MOZ_INCLUDE_SOURCE_INFO variable as an alternate way to include build revisions without setting MOZILLA_OFFICIAL. r=glandium --- build/Makefile.in | 2 +- configure.in | 7 +++++++ toolkit/content/Makefile.in | 2 +- toolkit/mozapps/installer/package-name.mk | 2 +- toolkit/xre/Makefile.in | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/build/Makefile.in b/build/Makefile.in index 496afdbfc6ec..2a1784767428 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -33,7 +33,7 @@ ifdef MOZ_SOURCE_STAMP DEFINES += -DMOZ_SOURCE_STAMP='$(MOZ_SOURCE_STAMP)' endif -ifdef MOZILLA_OFFICIAL +ifdef MOZ_INCLUDE_SOURCE_INFO source_repo ?= $(call getSourceRepo,$(topsrcdir)/$(MOZ_BUILD_APP)/..) ifneq (,$(source_repo)) DEFINES += -DMOZ_SOURCE_REPO='$(source_repo)' diff --git a/configure.in b/configure.in index e6afd9aad5e1..92daf2fe0456 100644 --- a/configure.in +++ b/configure.in @@ -8694,6 +8694,13 @@ AC_SUBST(MOZ_PKG_SPECIAL) AC_SUBST(MOZILLA_OFFICIAL) +# Build revisions should always be present in official builds +if test "$MOZILLA_OFFICIAL"; then + MOZ_INCLUDE_SOURCE_INFO=1 +fi + +AC_SUBST(MOZ_INCLUDE_SOURCE_INFO) + AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2) AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV) diff --git a/toolkit/content/Makefile.in b/toolkit/content/Makefile.in index 8779e2b7e41b..12fa0469a1ec 100644 --- a/toolkit/content/Makefile.in +++ b/toolkit/content/Makefile.in @@ -16,7 +16,7 @@ ifdef MOZ_SOURCE_STAMP DEFINES += -DSOURCE_CHANGESET='$(MOZ_SOURCE_STAMP)' endif -ifdef MOZILLA_OFFICIAL +ifdef MOZ_INCLUDE_SOURCE_INFO source_repo ?= $(call getSourceRepo) ifneq (,$(filter http%,$(source_repo))) DEFINES += -DSOURCE_REPO='$(source_repo)' diff --git a/toolkit/mozapps/installer/package-name.mk b/toolkit/mozapps/installer/package-name.mk index 8689b2157178..8e0e3ee29b68 100644 --- a/toolkit/mozapps/installer/package-name.mk +++ b/toolkit/mozapps/installer/package-name.mk @@ -148,7 +148,7 @@ MOZ_SOURCE_STAMP = $(firstword $(shell hg -R $(MOZILLA_DIR) parent --template="{ # bug: 746277 - preserve existing functionality. # MOZILLA_DIR="": cd $(SPACE); hg # succeeds if ~/.hg exists ########################################################################### -ifdef MOZILLA_OFFICIAL +ifdef MOZ_INCLUDE_SOURCE_INFO MOZ_SOURCE_REPO = $(call getSourceRepo,$(MOZILLA_DIR)$(NULL) $(NULL)) endif diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in index f50642871664..5ace8901e587 100644 --- a/toolkit/xre/Makefile.in +++ b/toolkit/xre/Makefile.in @@ -24,7 +24,7 @@ ifdef MOZ_SOURCE_STAMP INIARGS = --sourcestamp=$(MOZ_SOURCE_STAMP) - ifdef MOZILLA_OFFICIAL + ifdef MOZ_INCLUDE_SOURCE_INFO source_repo := $(call getSourceRepo) # extra sanity check for old versions of hg, no showconfig support From 2881077b96b308973637c6eb7a05a3194ecda897 Mon Sep 17 00:00:00 2001 From: Jeff Lu Date: Thu, 12 Feb 2015 15:21:00 +0100 Subject: [PATCH 039/115] Bug 1098415 - Skip DNS prefetch for local resources. r=sworkman --- dom/html/nsHTMLDNSPrefetch.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/dom/html/nsHTMLDNSPrefetch.cpp b/dom/html/nsHTMLDNSPrefetch.cpp index 711795ed5be1..cec9638552be 100644 --- a/dom/html/nsHTMLDNSPrefetch.cpp +++ b/dom/html/nsHTMLDNSPrefetch.cpp @@ -311,21 +311,29 @@ nsHTMLDNSPrefetch::nsDeferrals::SubmitQueue() // Only prefetch here if request was deferred and deferral not cancelled if (link && link->HasDeferredDNSPrefetchRequest()) { nsCOMPtr hrefURI(link ? link->GetURI() : nullptr); - if (hrefURI) - hrefURI->GetAsciiHost(hostName); + bool isLocalResource = false; + nsresult rv; - if (!hostName.IsEmpty()) { + hostName.Truncate(); + if (hrefURI) { + hrefURI->GetAsciiHost(hostName); + rv = NS_URIChainHasFlags(hrefURI, + nsIProtocolHandler::URI_IS_LOCAL_RESOURCE, + &isLocalResource); + } + + if (!hostName.IsEmpty() && NS_SUCCEEDED(rv) && !isLocalResource) { if (IsNeckoChild()) { gNeckoChild->SendHTMLDNSPrefetch(NS_ConvertUTF8toUTF16(hostName), mEntries[mTail].mFlags); } else { nsCOMPtr tmpOutstanding; - nsresult rv = sDNSService->AsyncResolve(hostName, - mEntries[mTail].mFlags - | nsIDNSService::RESOLVE_SPECULATE, - sDNSListener, nullptr, - getter_AddRefs(tmpOutstanding)); + rv = sDNSService->AsyncResolve(hostName, + mEntries[mTail].mFlags + | nsIDNSService::RESOLVE_SPECULATE, + sDNSListener, nullptr, + getter_AddRefs(tmpOutstanding)); // Tell link that deferred prefetch was requested if (NS_SUCCEEDED(rv)) link->OnDNSPrefetchRequested(); From 4f3952c1973314a8efad56e9681d6dbfd9c7040f Mon Sep 17 00:00:00 2001 From: Steve Singer Date: Sun, 15 Feb 2015 09:36:00 +0100 Subject: [PATCH 040/115] Bug 1130223 - Add an implementation to the big endian conditional. r=jesup --- .../trunk/webrtc/common_audio/wav_file.cc | 22 +++++++++--- .../trunk/webrtc/common_audio/wav_header.cc | 34 ++++++++++++++++++- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/media/webrtc/trunk/webrtc/common_audio/wav_file.cc b/media/webrtc/trunk/webrtc/common_audio/wav_file.cc index 880e1ec428d5..aa665b7a3565 100644 --- a/media/webrtc/trunk/webrtc/common_audio/wav_file.cc +++ b/media/webrtc/trunk/webrtc/common_audio/wav_file.cc @@ -45,13 +45,18 @@ WavReader::~WavReader() { } size_t WavReader::ReadSamples(size_t num_samples, int16_t* samples) { -#ifndef WEBRTC_ARCH_LITTLE_ENDIAN -#error "Need to convert samples to big-endian when reading from WAV file" -#endif + + const size_t read = fread(samples, sizeof(*samples), num_samples, file_handle_); // If we didn't read what was requested, ensure we've reached the EOF. CHECK(read == num_samples || feof(file_handle_)); +#ifndef WEBRTC_ARCH_LITTLE_ENDIAN + //convert to big-endian + for(size_t idx = 0; idx < num_samples; idx++) { + samples[idx] = (samples[idx]<<8) | (samples[idx]>>8); + } +#endif return read; } @@ -99,10 +104,17 @@ WavWriter::~WavWriter() { void WavWriter::WriteSamples(const int16_t* samples, size_t num_samples) { #ifndef WEBRTC_ARCH_LITTLE_ENDIAN -#error "Need to convert samples to little-endian when writing to WAV file" -#endif + int16_t * le_samples = new int16_t[num_samples]; + for(size_t idx = 0; idx < num_samples; idx++) { + le_samples[idx] = (samples[idx]<<8) | (samples[idx]>>8); + } + const size_t written = + fwrite(le_samples, sizeof(*le_samples), num_samples, file_handle_); + delete []le_samples; +#else const size_t written = fwrite(samples, sizeof(*samples), num_samples, file_handle_); +#endif CHECK_EQ(num_samples, written); num_samples_ += static_cast(written); CHECK(written <= std::numeric_limits::max() || diff --git a/media/webrtc/trunk/webrtc/common_audio/wav_header.cc b/media/webrtc/trunk/webrtc/common_audio/wav_header.cc index 8c781fb4cfca..5cde4b3f8c3b 100644 --- a/media/webrtc/trunk/webrtc/common_audio/wav_header.cc +++ b/media/webrtc/trunk/webrtc/common_audio/wav_header.cc @@ -128,7 +128,39 @@ static inline std::string ReadFourCC(uint32_t x) { return std::string(reinterpret_cast(&x), 4); } #else -#error "Write be-to-le conversion functions" +static inline void WriteLE16(uint16_t* f, uint16_t x) { + *f = ((x << 8) & 0xff00) | ( ( x >> 8) & 0x00ff); +} + +static inline void WriteLE32(uint32_t* f, uint32_t x) { + *f = ( (x & 0x000000ff) << 24 ) + | ((x & 0x0000ff00) << 8) + | ((x & 0x00ff0000) >> 8) + | ((x & 0xff000000) >> 24 ); +} + +static inline void WriteFourCC(uint32_t* f, char a, char b, char c, char d) { + *f = (static_cast(a) << 24 ) + | (static_cast(b) << 16) + | (static_cast(c) << 8) + | (static_cast(d) ); +} + +static inline uint16_t ReadLE16(uint16_t x) { + return (( x & 0x00ff) << 8 )| ((x & 0xff00)>>8); +} + +static inline uint32_t ReadLE32(uint32_t x) { + return ( (x & 0x000000ff) << 24 ) + | ( (x & 0x0000ff00) << 8 ) + | ( (x & 0x00ff0000) >> 8) + | ( (x & 0xff000000) >> 24 ); +} + +static inline std::string ReadFourCC(uint32_t x) { + x = ReadLE32(x); + return std::string(reinterpret_cast(&x), 4); +} #endif static inline uint32_t RiffChunkSize(uint32_t bytes_in_payload) { From 2f2d55812691533087478c80ac1d5b8902f3424d Mon Sep 17 00:00:00 2001 From: Douglas Crosher Date: Wed, 18 Feb 2015 09:05:29 +1100 Subject: [PATCH 041/115] Bug 1133203 - Jit: do not flag AssertRange as movable. r=sunfish --- js/src/jit/MIR.h | 1 - 1 file changed, 1 deletion(-) diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 9740e6354a2e..a36c40a1b0e5 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -4228,7 +4228,6 @@ class MAssertRange : MUnaryInstruction(ins), assertedRange_(assertedRange) { setGuard(); - setMovable(); setResultType(MIRType_None); } From 98fd03c4e0d940527b852fd9f1f7bc913443699b Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 18 Feb 2015 09:25:51 +0000 Subject: [PATCH 042/115] Bug 1105644 - Lowercase words before passing them to libhyphen, so as to match patterns fully. r=smontagu --- intl/hyphenation/nsHyphenator.cpp | 43 ++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/intl/hyphenation/nsHyphenator.cpp b/intl/hyphenation/nsHyphenator.cpp index 062c24a30843..43290a1f3795 100644 --- a/intl/hyphenation/nsHyphenator.cpp +++ b/intl/hyphenation/nsHyphenator.cpp @@ -80,9 +80,46 @@ nsHyphenator::Hyphenate(const nsAString& aString, } if (inWord) { - const char16_t *begin = aString.BeginReading(); - NS_ConvertUTF16toUTF8 utf8(begin + wordStart, - wordLimit - wordStart); + // Convert the word to utf-8 for libhyphen, lowercasing it as we go + // so that it will match the (lowercased) patterns (bug 1105644). + nsAutoCString utf8; + const char16_t *begin = aString.BeginReading() + wordStart; + const char16_t *end = aString.BeginReading() + wordLimit; + while (begin < end) { + uint32_t ch = *begin++; + + if (NS_IS_HIGH_SURROGATE(ch)) { + if (begin < end && NS_IS_LOW_SURROGATE(*begin)) { + ch = SURROGATE_TO_UCS4(ch, *begin++); + } else { + ch = 0xfffd; // unpaired surrogate, treat as REPLACEMENT CHAR + } + } else if (NS_IS_LOW_SURROGATE(ch)) { + ch = 0xfffd; // unpaired surrogate + } + + // XXX What about language-specific casing? Consider Turkish I/i... + // In practice, it looks like the current patterns will not be + // affected by this, as they treat dotted and undotted i similarly. + ch = ToLowerCase(ch); + + if (ch < 0x80) { // U+0000 - U+007F + utf8.Append(ch); + } else if (ch < 0x0800) { // U+0100 - U+07FF + utf8.Append(0xC0 | (ch >> 6)); + utf8.Append(0x80 | (0x003F & ch)); + } else if (ch < 0x10000) { // U+0800 - U+D7FF,U+E000 - U+FFFF + utf8.Append(0xE0 | (ch >> 12)); + utf8.Append(0x80 | (0x003F & (ch >> 6))); + utf8.Append(0x80 | (0x003F & ch)); + } else { + utf8.Append(0xF0 | (ch >> 18)); + utf8.Append(0x80 | (0x003F & (ch >> 12))); + utf8.Append(0x80 | (0x003F & (ch >> 6))); + utf8.Append(0x80 | (0x003F & ch)); + } + } + nsAutoTArray utf8hyphens; utf8hyphens.SetLength(utf8.Length() + 5); char **rep = nullptr; From d8f78481aea68f9c73dd7c5e44b5c2637a9c1582 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 18 Feb 2015 09:25:57 +0000 Subject: [PATCH 043/115] Bug 1105644 - Update reftests for improved handling of capitalized words. r=smontagu --- layout/reftests/text/auto-hyphenation-eo-1-ref.html | 2 +- layout/reftests/text/auto-hyphenation-nb-1-ref.html | 2 +- layout/reftests/text/auto-hyphenation-nn-1-ref.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/layout/reftests/text/auto-hyphenation-eo-1-ref.html b/layout/reftests/text/auto-hyphenation-eo-1-ref.html index f55b400d88ba..ae38a7e887b0 100644 --- a/layout/reftests/text/auto-hyphenation-eo-1-ref.html +++ b/layout/reftests/text/auto-hyphenation-eo-1-ref.html @@ -5,7 +5,7 @@
-Ĉi­uj ho­moj es­tas de­na­s­ke li­be­raj kaj ega­laj laÅ­ di­g­no kaj raj­toj. +Ĉiuj ho­moj es­tas de­na­s­ke li­be­raj kaj ega­laj laÅ­ di­g­no kaj raj­toj.
diff --git a/layout/reftests/text/auto-hyphenation-nb-1-ref.html b/layout/reftests/text/auto-hyphenation-nb-1-ref.html index ed3475108057..79ecf9b356da 100644 --- a/layout/reftests/text/auto-hyphenation-nb-1-ref.html +++ b/layout/reftests/text/auto-hyphenation-nb-1-ref.html @@ -5,7 +5,7 @@
-Al­le men­nes­ker er født frie og med sam­me men­neske­verd og men­neske­ret­tig­he­ter. +Alle men­nes­ker er født frie og med sam­me men­neske­verd og men­neske­ret­tig­he­ter.

at­ten­de diff --git a/layout/reftests/text/auto-hyphenation-nn-1-ref.html b/layout/reftests/text/auto-hyphenation-nn-1-ref.html index 8301439a9769..80f0e86fb62e 100644 --- a/layout/reftests/text/auto-hyphenation-nn-1-ref.html +++ b/layout/reftests/text/auto-hyphenation-nn-1-ref.html @@ -5,7 +5,7 @@

-Al­le men­nes­ke er fød­de til fri­dom og med same men­neske­verd og men­neske­ret­tar. +Alle men­nes­ke er fød­de til fri­dom og med same men­neske­verd og men­neske­ret­tar.

att­en­de From 4d3611e544014a70f5a57eca771dad5735c75463 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Thu, 19 Feb 2015 00:03:25 +1300 Subject: [PATCH 044/115] Bug 1039006 - Enable the preference for CSS Ruby by default. r=dbaron --HG-- extra : source : 5888894940b4cd7751d90cc0f2f9f844b7268cc0 --- modules/libpref/init/all.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 527ef5874193..5b7e03a92f09 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -2178,7 +2178,7 @@ pref("layout.css.grid.enabled", false); // in nsLayoutStylesheetCache::EnsureGlobal and the invalidation of // mUASheet in nsLayoutStylesheetCache::DependentPrefChanged (if it's not // otherwise needed) are removed. -pref("layout.css.ruby.enabled", false); +pref("layout.css.ruby.enabled", true); // Is support for CSS display:contents enabled? pref("layout.css.display-contents.enabled", true); From b2df85cfa37f311e307bf87e2c39ebdf282753e3 Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Wed, 18 Feb 2015 13:04:12 +0100 Subject: [PATCH 045/115] Bug 1120503 - Fix seal/freeze for typed arrays. r=Waldo --- js/src/jsobj.cpp | 24 +++------- .../ecma_6/TypedArray/seal-and-freeze.js | 48 +++++++++++++++++++ 2 files changed, 54 insertions(+), 18 deletions(-) create mode 100644 js/src/tests/ecma_6/TypedArray/seal-and-freeze.js diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index a333aa74a24c..b7344fd830b9 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -1098,7 +1098,7 @@ js::SetIntegrityLevel(JSContext *cx, HandleObject obj, IntegrityLevel level) return true; } -/* ES6 rev 29 (6 Dec 2014) 7.3.14. */ +// ES6 draft rev33 (12 Feb 2015) 7.3.15 bool js::TestIntegrityLevel(JSContext *cx, HandleObject obj, IntegrityLevel level, bool *result) { @@ -1111,38 +1111,26 @@ js::TestIntegrityLevel(JSContext *cx, HandleObject obj, IntegrityLevel level, bo return true; } - if (IsAnyTypedArray(obj)) { - if (level == IntegrityLevel::Sealed) { - // Typed arrays are considered sealed (bug 1120503). - *result = true; - } else { - // Typed arrays cannot be frozen, but an empty typed array is - // considered frozen (bug 1120503). - *result = (AnyTypedArrayLength(obj) == 0); - } - return true; - } - // Steps 7-8. AutoIdVector props(cx); if (!GetPropertyKeys(cx, obj, JSITER_HIDDEN | JSITER_OWNONLY | JSITER_SYMBOLS, &props)) return false; - // Step 11. + // Step 9. RootedId id(cx); Rooted desc(cx); for (size_t i = 0, len = props.length(); i < len; i++) { id = props[i]; - // Steps 11.a-b. + // Steps 9.a-b. if (!GetOwnPropertyDescriptor(cx, obj, id, &desc)) return false; - // Step 11.c. + // Step 9.c. if (!desc.object()) continue; - // Steps 11.c.i-ii. + // Steps 9.c.i-ii. if (!desc.isPermanent() || (level == IntegrityLevel::Frozen && desc.isDataDescriptor() && desc.isWritable())) { @@ -1151,7 +1139,7 @@ js::TestIntegrityLevel(JSContext *cx, HandleObject obj, IntegrityLevel level, bo } } - // Step 12. + // Step 10. *result = true; return true; } diff --git a/js/src/tests/ecma_6/TypedArray/seal-and-freeze.js b/js/src/tests/ecma_6/TypedArray/seal-and-freeze.js new file mode 100644 index 000000000000..f3919f7eae83 --- /dev/null +++ b/js/src/tests/ecma_6/TypedArray/seal-and-freeze.js @@ -0,0 +1,48 @@ +"use strict"; + +// Seal +assertEq(Object.isSealed(new Int32Array(2)), false); +assertEq(Object.isSealed(new Int32Array(0)), false); + +var array = new Int32Array(0); +Object.preventExtensions(array); +assertEq(Object.isSealed(array), true); + +array = new Int32Array(1); +array.b = "test"; +Object.preventExtensions(array); +assertEq(Object.isSealed(array), false); +Object.defineProperty(array, "b", {configurable: false}); +assertEq(Object.isSealed(array), true); + +array = new Int32Array(2); +array.b = "test"; +Object.seal(array); +assertEq(Object.isSealed(array), true); +assertThrowsInstanceOf(() => array.c = 15, TypeError); + +// Freeze +assertEq(Object.isFrozen(new Int32Array(2)), false); +assertEq(Object.isFrozen(new Int32Array(0)), false); + +// Empty non-extensible typed-array is trvially frozen +var array = new Int32Array(0); +Object.preventExtensions(array); +assertEq(Object.isFrozen(array), true); + +array = new Int32Array(0); +array.b = "test"; +assertEq(Object.isFrozen(array), false); +Object.preventExtensions(array); +assertEq(Object.isFrozen(array), false); +Object.defineProperty(array, "b", {configurable: false, writable: false}); +assertEq(Object.isFrozen(array), true); + +// Non-empty typed arrays can never be frozen, because the elements stay writable +array = new Int32Array(1); +assertThrowsInstanceOf(() => Object.freeze(array), TypeError); +assertEq(Object.isExtensible(array), false); +assertEq(Object.isFrozen(array), false); + +if (typeof reportCompare === "function") + reportCompare(true, true); From 5e9b465d18a923c6fb4aed86a73cfd63333aaaa9 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Wed, 18 Feb 2015 12:35:05 +0000 Subject: [PATCH 046/115] Bug 1133759 - Always shrink GC buffers at the end of a shrinking GC r=terrence --- dom/base/nsJSEnvironment.cpp | 7 +++++-- js/public/GCAPI.h | 5 +++-- js/src/gc/Statistics.cpp | 4 ++-- js/src/jsgc.cpp | 6 +++++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 50b966a62b45..35bc0df92338 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -2204,8 +2204,11 @@ DOMGCSliceCallback(JSRuntime *aRt, JS::GCProgress aProgress, const JS::GCDescrip nsJSContext::KillFullGCTimer(); // Avoid shrinking during heavy activity, which is suggested by - // compartment GC. - nsJSContext::PokeShrinkGCBuffers(); + // compartment GC. We don't need to shrink after a shrinking GC as this + // happens automatically in this case. + if (aDesc.invocationKind_ == GC_NORMAL) { + nsJSContext::PokeShrinkGCBuffers(); + } } if (ShouldTriggerCC(nsCycleCollector_suspectedCount())) { diff --git a/js/public/GCAPI.h b/js/public/GCAPI.h index 49853ccef591..1c49d3487373 100644 --- a/js/public/GCAPI.h +++ b/js/public/GCAPI.h @@ -263,9 +263,10 @@ enum GCProgress { struct JS_PUBLIC_API(GCDescription) { bool isCompartment_; + JSGCInvocationKind invocationKind_; - explicit GCDescription(bool isCompartment) - : isCompartment_(isCompartment) {} + GCDescription(bool isCompartment, JSGCInvocationKind kind) + : isCompartment_(isCompartment), invocationKind_(kind) {} char16_t *formatMessage(JSRuntime *rt) const; char16_t *formatJSON(JSRuntime *rt, uint64_t timestamp) const; diff --git a/js/src/gc/Statistics.cpp b/js/src/gc/Statistics.cpp index 1716f2d5f196..749fbdc23adb 100644 --- a/js/src/gc/Statistics.cpp +++ b/js/src/gc/Statistics.cpp @@ -1005,7 +1005,7 @@ Statistics::beginSlice(const ZoneGCStats &zoneStats, JSGCInvocationKind gckind, bool wasFullGC = zoneStats.isCollectingAllZones(); if (sliceCallback) (*sliceCallback)(runtime, first ? JS::GC_CYCLE_BEGIN : JS::GC_SLICE_BEGIN, - JS::GCDescription(!wasFullGC)); + JS::GCDescription(!wasFullGC, gckind)); } } @@ -1029,7 +1029,7 @@ Statistics::endSlice() bool wasFullGC = zoneStats.isCollectingAllZones(); if (sliceCallback) (*sliceCallback)(runtime, last ? JS::GC_CYCLE_END : JS::GC_SLICE_END, - JS::GCDescription(!wasFullGC)); + JS::GCDescription(!wasFullGC, gckind)); } /* Do this after the slice callback since it uses these values. */ diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index e78cb2bcdc6f..54ed4ab0ff8e 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -5463,6 +5463,10 @@ GCRuntime::compactPhase(bool lastGC) releaseRelocatedArenas(relocatedList); #endif + // Ensure execess chunks are returns to the system and free arenas + // decommitted. + shrinkBuffers(); + #ifdef DEBUG CheckHashTablesAfterMovingGC(rt); for (GCZonesIter zone(rt); !zone.done(); zone.next()) { @@ -6303,6 +6307,7 @@ js::PrepareForDebugGC(JSRuntime *rt) JS_PUBLIC_API(void) JS::ShrinkGCBuffers(JSRuntime *rt) { + MOZ_ASSERT(!rt->isHeapBusy()); rt->gc.shrinkBuffers(); } @@ -6311,7 +6316,6 @@ GCRuntime::shrinkBuffers() { AutoLockHelperThreadState helperLock; AutoLockGC lock(rt); - MOZ_ASSERT(!rt->isHeapBusy()); if (CanUseExtraThreads()) helperState.startBackgroundShrink(lock); From a4471f613c867c161fa18e41cb46b665aaa2d66a Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Wed, 18 Feb 2015 14:48:11 +0100 Subject: [PATCH 047/115] Backed out changeset a36c441817d8 (bug 1105644) --- layout/reftests/text/auto-hyphenation-eo-1-ref.html | 2 +- layout/reftests/text/auto-hyphenation-nb-1-ref.html | 2 +- layout/reftests/text/auto-hyphenation-nn-1-ref.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/layout/reftests/text/auto-hyphenation-eo-1-ref.html b/layout/reftests/text/auto-hyphenation-eo-1-ref.html index ae38a7e887b0..f55b400d88ba 100644 --- a/layout/reftests/text/auto-hyphenation-eo-1-ref.html +++ b/layout/reftests/text/auto-hyphenation-eo-1-ref.html @@ -5,7 +5,7 @@

-Ĉiuj ho­moj es­tas de­na­s­ke li­be­raj kaj ega­laj laÅ­ di­g­no kaj raj­toj. +Ĉi­uj ho­moj es­tas de­na­s­ke li­be­raj kaj ega­laj laÅ­ di­g­no kaj raj­toj.
diff --git a/layout/reftests/text/auto-hyphenation-nb-1-ref.html b/layout/reftests/text/auto-hyphenation-nb-1-ref.html index 79ecf9b356da..ed3475108057 100644 --- a/layout/reftests/text/auto-hyphenation-nb-1-ref.html +++ b/layout/reftests/text/auto-hyphenation-nb-1-ref.html @@ -5,7 +5,7 @@
-Alle men­nes­ker er født frie og med sam­me men­neske­verd og men­neske­ret­tig­he­ter. +Al­le men­nes­ker er født frie og med sam­me men­neske­verd og men­neske­ret­tig­he­ter.

at­ten­de diff --git a/layout/reftests/text/auto-hyphenation-nn-1-ref.html b/layout/reftests/text/auto-hyphenation-nn-1-ref.html index 80f0e86fb62e..8301439a9769 100644 --- a/layout/reftests/text/auto-hyphenation-nn-1-ref.html +++ b/layout/reftests/text/auto-hyphenation-nn-1-ref.html @@ -5,7 +5,7 @@

-Alle men­nes­ke er fød­de til fri­dom og med same men­neske­verd og men­neske­ret­tar. +Al­le men­nes­ke er fød­de til fri­dom og med same men­neske­verd og men­neske­ret­tar.

att­en­de From 1663e96baa291c431a29a91d83eab43914cb7a55 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Wed, 18 Feb 2015 14:51:24 +0100 Subject: [PATCH 048/115] Backed out changeset e46f80935409 (bug 1105644) for ASAN reftest failures --- intl/hyphenation/nsHyphenator.cpp | 43 +++---------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/intl/hyphenation/nsHyphenator.cpp b/intl/hyphenation/nsHyphenator.cpp index 43290a1f3795..062c24a30843 100644 --- a/intl/hyphenation/nsHyphenator.cpp +++ b/intl/hyphenation/nsHyphenator.cpp @@ -80,46 +80,9 @@ nsHyphenator::Hyphenate(const nsAString& aString, } if (inWord) { - // Convert the word to utf-8 for libhyphen, lowercasing it as we go - // so that it will match the (lowercased) patterns (bug 1105644). - nsAutoCString utf8; - const char16_t *begin = aString.BeginReading() + wordStart; - const char16_t *end = aString.BeginReading() + wordLimit; - while (begin < end) { - uint32_t ch = *begin++; - - if (NS_IS_HIGH_SURROGATE(ch)) { - if (begin < end && NS_IS_LOW_SURROGATE(*begin)) { - ch = SURROGATE_TO_UCS4(ch, *begin++); - } else { - ch = 0xfffd; // unpaired surrogate, treat as REPLACEMENT CHAR - } - } else if (NS_IS_LOW_SURROGATE(ch)) { - ch = 0xfffd; // unpaired surrogate - } - - // XXX What about language-specific casing? Consider Turkish I/i... - // In practice, it looks like the current patterns will not be - // affected by this, as they treat dotted and undotted i similarly. - ch = ToLowerCase(ch); - - if (ch < 0x80) { // U+0000 - U+007F - utf8.Append(ch); - } else if (ch < 0x0800) { // U+0100 - U+07FF - utf8.Append(0xC0 | (ch >> 6)); - utf8.Append(0x80 | (0x003F & ch)); - } else if (ch < 0x10000) { // U+0800 - U+D7FF,U+E000 - U+FFFF - utf8.Append(0xE0 | (ch >> 12)); - utf8.Append(0x80 | (0x003F & (ch >> 6))); - utf8.Append(0x80 | (0x003F & ch)); - } else { - utf8.Append(0xF0 | (ch >> 18)); - utf8.Append(0x80 | (0x003F & (ch >> 12))); - utf8.Append(0x80 | (0x003F & (ch >> 6))); - utf8.Append(0x80 | (0x003F & ch)); - } - } - + const char16_t *begin = aString.BeginReading(); + NS_ConvertUTF16toUTF8 utf8(begin + wordStart, + wordLimit - wordStart); nsAutoTArray utf8hyphens; utf8hyphens.SetLength(utf8.Length() + 5); char **rep = nullptr; From 6ae0cb6aa4b4607b2c2f2462d86993a7aa3f2461 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Mon, 16 Feb 2015 21:41:48 -0500 Subject: [PATCH 049/115] Bug 1131695 - Extract a GetLayoutDeviceToCSSScale helper function in TabParent. r=fabrice --- dom/ipc/TabParent.cpp | 26 ++++++++++++-------------- dom/ipc/TabParent.h | 1 + 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 474fab0a7c17..038c111620a4 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -1160,23 +1160,21 @@ bool TabParent::SendRealMouseEvent(WidgetMouseEvent& event) return SendRealMouseButtonEvent(event); } -CSSPoint TabParent::AdjustTapToChildWidget(const CSSPoint& aPoint) +LayoutDeviceToCSSScale +TabParent::GetLayoutDeviceToCSSScale() { nsCOMPtr content = do_QueryInterface(mFrameElement); + nsIDocument* doc = (content ? content->OwnerDoc() : nullptr); + nsIPresShell* shell = (doc ? doc->GetShell() : nullptr); + nsPresContext* ctx = (shell ? shell->GetPresContext() : nullptr); + return LayoutDeviceToCSSScale(ctx + ? (float)ctx->AppUnitsPerDevPixel() / nsPresContext::AppUnitsPerCSSPixel() + : 0.0f); +} - if (!content || !content->OwnerDoc()) { - return aPoint; - } - - nsIDocument* doc = content->OwnerDoc(); - if (!doc || !doc->GetShell()) { - return aPoint; - } - nsPresContext* presContext = doc->GetShell()->GetPresContext(); - - return aPoint + CSSPoint( - presContext->DevPixelsToFloatCSSPixels(mChildProcessOffsetAtTouchStart.x), - presContext->DevPixelsToFloatCSSPixels(mChildProcessOffsetAtTouchStart.y)); +CSSPoint TabParent::AdjustTapToChildWidget(const CSSPoint& aPoint) +{ + return aPoint + (LayoutDevicePoint(mChildProcessOffsetAtTouchStart) * GetLayoutDeviceToCSSScale()); } bool TabParent::SendHandleSingleTap(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid) diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index 23b309668342..04109daa6701 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -264,6 +264,7 @@ public: bool MapEventCoordinatesForChildProcess(mozilla::WidgetEvent* aEvent); void MapEventCoordinatesForChildProcess(const LayoutDeviceIntPoint& aOffset, mozilla::WidgetEvent* aEvent); + LayoutDeviceToCSSScale GetLayoutDeviceToCSSScale(); virtual bool RecvRequestNativeKeyBindings(const mozilla::WidgetKeyboardEvent& aEvent, MaybeNativeKeyBinding* aBindings) MOZ_OVERRIDE; From b26756534f15463983454dd44de4c0054053afa0 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Mon, 16 Feb 2015 21:41:49 -0500 Subject: [PATCH 050/115] Bug 1131695 - Ensure that mouse and touch events sent via BrowserElementParent to the child are offsetted correctly. r=fabrice --- dom/browser-element/BrowserElementParent.js | 24 ++++++++++++++ .../mochitest/browserElement_SendEvent.js | 31 ++++++++++++++----- dom/interfaces/base/nsITabParent.idl | 4 ++- dom/ipc/TabParent.cpp | 12 +++++++ 4 files changed, 63 insertions(+), 8 deletions(-) diff --git a/dom/browser-element/BrowserElementParent.js b/dom/browser-element/BrowserElementParent.js index 8ba375ad8cbc..701dcd87b186 100644 --- a/dom/browser-element/BrowserElementParent.js +++ b/dom/browser-element/BrowserElementParent.js @@ -539,7 +539,24 @@ BrowserElementParent.prototype = { return this._frameLoader.visible; }, + getChildProcessOffset: function() { + let offset = { x: 0, y: 0 }; + let tabParent = this._frameLoader.tabParent; + if (tabParent) { + let offsetX = {}; + let offsetY = {}; + tabParent.getChildProcessOffset(offsetX, offsetY); + offset.x = offsetX.value; + offset.y = offsetY.value; + } + return offset; + }, + sendMouseEvent: defineNoReturnMethod(function(type, x, y, button, clickCount, modifiers) { + let offset = this.getChildProcessOffset(); + x += offset.x; + y += offset.y; + this._sendAsyncMsg("send-mouse-event", { "type": type, "x": x, @@ -567,6 +584,13 @@ BrowserElementParent.prototype = { count, modifiers); } else { + let offset = this.getChildProcessOffset(); + for (var i = 0; i < touchesX.length; i++) { + touchesX[i] += offset.x; + } + for (var i = 0; i < touchesY.length; i++) { + touchesY[i] += offset.y; + } this._sendAsyncMsg("send-touch-event", { "type": type, "identifiers": identifiers, diff --git a/dom/browser-element/mochitest/browserElement_SendEvent.js b/dom/browser-element/mochitest/browserElement_SendEvent.js index 57f09e9be3cd..88e65d96fc13 100644 --- a/dom/browser-element/mochitest/browserElement_SendEvent.js +++ b/dom/browser-element/mochitest/browserElement_SendEvent.js @@ -12,9 +12,26 @@ function runTest() { var iframe = document.createElement("iframe"); iframe.setAttribute('mozbrowser', 'true'); document.body.appendChild(iframe); + var x = 10; + var y = 10; + // First we force a reflow so that getChildProcessOffset actually returns + // meaningful data. + iframe.getBoundingClientRect(); + // We need to make sure the event coordinates are actually inside the iframe, + // relative to the chome window. + var tabParent = SpecialPowers.wrap(iframe) + .QueryInterface(SpecialPowers.Ci.nsIFrameLoaderOwner) + .frameLoader.tabParent; + if (tabParent) { + let offsetX = {}; + let offsetY = {}; + tabParent.getChildProcessOffset(offsetX, offsetY); + x -= offsetX.value; + y -= offsetY.value; + } iframe.addEventListener("mozbrowserloadend", function onloadend(e) { - iframe.sendMouseEvent("mousedown", 10, 10, 0, 1, 0); + iframe.sendMouseEvent("mousedown", x, y, 0, 1, 0); }); iframe.addEventListener("mozbrowserlocationchange", function onlocchange(e) { @@ -24,11 +41,11 @@ function runTest() { switch (a.hash) { case "#mousedown": ok(true, "Receive a mousedown event."); - iframe.sendMouseEvent("mousemove", 10, 10, 0, 0, 0); + iframe.sendMouseEvent("mousemove", x, y, 0, 0, 0); break; case "#mousemove": ok(true, "Receive a mousemove event."); - iframe.sendMouseEvent("mouseup", 10, 10, 0, 1, 0); + iframe.sendMouseEvent("mouseup", x, y, 0, 1, 0); break; case "#mouseup": ok(true, "Receive a mouseup event."); @@ -36,7 +53,7 @@ function runTest() { case "#click": ok(true, "Receive a click event."); if (SpecialPowers.getIntPref("dom.w3c_touch_events.enabled") != 0) { - iframe.sendTouchEvent("touchstart", [1], [10], [10], [2], [2], + iframe.sendTouchEvent("touchstart", [1], [x], [y], [2], [2], [20], [0.5], 1, 0); } else { iframe.removeEventListener('mozbrowserlocationchange', onlocchange); @@ -45,16 +62,16 @@ function runTest() { break; case "#touchstart": ok(true, "Receive a touchstart event."); - iframe.sendTouchEvent("touchmove", [1], [10], [10], [2], [2], + iframe.sendTouchEvent("touchmove", [1], [x], [y], [2], [2], [20], [0.5], 1, 0); case "#touchmove": ok(true, "Receive a touchmove event."); - iframe.sendTouchEvent("touchend", [1], [10], [10], [2], [2], + iframe.sendTouchEvent("touchend", [1], [x], [y], [2], [2], [20], [0.5], 1, 0); break; case "#touchend": ok(true, "Receive a touchend event."); - iframe.sendTouchEvent("touchcancel", [1], [10], [10], [2], [2], + iframe.sendTouchEvent("touchcancel", [1], [x], [y], [2], [2], [20], [0.5], 1, 0); iframe.removeEventListener('mozbrowserlocationchange', onlocchange); SimpleTest.finish(); diff --git a/dom/interfaces/base/nsITabParent.idl b/dom/interfaces/base/nsITabParent.idl index 5f1f59210b25..01c4fa1842bb 100644 --- a/dom/interfaces/base/nsITabParent.idl +++ b/dom/interfaces/base/nsITabParent.idl @@ -5,7 +5,7 @@ #include "domstubs.idl" -[scriptable, uuid(30361a5b-a3b8-4dbc-b464-e08761abb123)] +[scriptable, uuid(b19038ba-0d75-40d2-be35-742e26d33bf9)] interface nsITabParent : nsISupports { void injectTouchEvent(in AString aType, @@ -19,6 +19,8 @@ interface nsITabParent : nsISupports in uint32_t count, in long aModifiers); + void getChildProcessOffset(out int32_t aCssX, out int32_t aCssY); + readonly attribute boolean useAsyncPanZoom; void setIsDocShellActive(in bool aIsActive); diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 038c111620a4..e8b934eb08bf 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -1757,6 +1757,18 @@ TabParent::RecvEnableDisableCommands(const nsString& aAction, return true; } +NS_IMETHODIMP +TabParent::GetChildProcessOffset(int32_t* aOutCssX, int32_t* aOutCssY) +{ + NS_ENSURE_ARG(aOutCssX); + NS_ENSURE_ARG(aOutCssY); + CSSPoint offset = LayoutDevicePoint(GetChildProcessOffset()) + * GetLayoutDeviceToCSSScale(); + *aOutCssX = offset.x; + *aOutCssY = offset.y; + return NS_OK; +} + LayoutDeviceIntPoint TabParent::GetChildProcessOffset() { From 52bf0b72d23367c5849dd4c6f22c5895914cfb17 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Tue, 16 Dec 2014 12:55:02 -0500 Subject: [PATCH 051/115] Bug 883954 - part 1 - make GENERATED_FILES emit proper moz.build objects; r=gps This patch is mostly useful for being able to see these changes independently of the major changes to GENERATED_FILES. We are going to need proper moz.build objects for GENERATED_FILES when we add the ability to define scripts and arguments for them, so we might as well do that first. --- python/mozbuild/mozbuild/backend/recursivemake.py | 4 ++++ python/mozbuild/mozbuild/frontend/data.py | 12 ++++++++++++ python/mozbuild/mozbuild/frontend/emitter.py | 7 ++++++- .../test/backend/data/generated-files/moz.build | 5 +++++ .../mozbuild/test/backend/test_recursivemake.py | 14 ++++++++++++++ .../test/frontend/data/generated-files/moz.build | 5 +++++ .../mozbuild/test/frontend/test_emitter.py | 13 +++++++++++++ 7 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 python/mozbuild/mozbuild/test/backend/data/generated-files/moz.build create mode 100644 python/mozbuild/mozbuild/test/frontend/data/generated-files/moz.build diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py index 451711218fb5..a3e15bc5aadf 100644 --- a/python/mozbuild/mozbuild/backend/recursivemake.py +++ b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -36,6 +36,7 @@ from ..frontend.data import ( Exports, ExternalLibrary, FinalTargetFiles, + GeneratedFile, GeneratedInclude, GeneratedSources, HostLibrary, @@ -404,6 +405,9 @@ class RecursiveMakeBackend(CommonBackend): elif isinstance(obj, Exports): self._process_exports(obj, obj.exports, backend_file) + elif isinstance(obj, GeneratedFile): + backend_file.write('GENERATED_FILES += %s\n' % obj.filename) + elif isinstance(obj, TestHarnessFiles): self._process_test_harness_files(obj, backend_file) diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py index 0e2d4f5b8b6e..90e889d73efc 100644 --- a/python/mozbuild/mozbuild/frontend/data.py +++ b/python/mozbuild/mozbuild/frontend/data.py @@ -853,6 +853,18 @@ class FinalTargetFiles(ContextDerived): self.target = target +class GeneratedFile(ContextDerived): + """Represents a generated file.""" + + __slots__ = ( + 'filename', + ) + + def __init__(self, context, filename): + ContextDerived.__init__(self, context) + self.filename = filename + + class ClassPathEntry(object): """Represents a classpathentry in an Android Eclipse project.""" diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index ba27f3d6d37b..06690edcf6eb 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -32,6 +32,7 @@ from .data import ( Exports, FinalTargetFiles, GeneratedEventWebIDLFile, + GeneratedFile, GeneratedInclude, GeneratedSources, GeneratedWebIDLFile, @@ -410,7 +411,6 @@ class TreeMetadataEmitter(LoggingMixin): 'EXTRA_PP_COMPONENTS', 'FAIL_ON_WARNINGS', 'USE_STATIC_LIBS', - 'GENERATED_FILES', 'IS_GYP_DIR', 'MSVC_ENABLE_PGO', 'NO_DIST_INSTALL', @@ -518,6 +518,11 @@ class TreeMetadataEmitter(LoggingMixin): yield Exports(context, exports, dist_install=not context.get('NO_DIST_INSTALL', False)) + generated_files = context.get('GENERATED_FILES') + if generated_files: + for f in generated_files: + yield GeneratedFile(context, f) + test_harness_files = context.get('TEST_HARNESS_FILES') if test_harness_files: srcdir_files = defaultdict(list) diff --git a/python/mozbuild/mozbuild/test/backend/data/generated-files/moz.build b/python/mozbuild/mozbuild/test/backend/data/generated-files/moz.build new file mode 100644 index 000000000000..f1a60317242d --- /dev/null +++ b/python/mozbuild/mozbuild/test/backend/data/generated-files/moz.build @@ -0,0 +1,5 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# Any copyright is dedicated to the Public Domain. +# http://creativecommons.org/publicdomain/zero/1.0/ + +GENERATED_FILES += [ 'bar.c', 'foo.c' ] diff --git a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py index e1d1e8b78531..18b5f3c8c601 100644 --- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py +++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py @@ -369,6 +369,20 @@ class TestRecursiveMakeBackend(BackendTester): self.assertIn('mozilla/mozilla1.h', m) self.assertIn('mozilla/dom/dom2.h', m) + def test_generated_files(self): + """Ensure GENERATED_FILES is handled properly.""" + env = self._consume('generated-files', RecursiveMakeBackend) + + backend_path = mozpath.join(env.topobjdir, 'backend.mk') + lines = [l.strip() for l in open(backend_path, 'rt').readlines()[2:]] + + expected = [ + 'GENERATED_FILES += bar.c', + 'GENERATED_FILES += foo.c', + ] + + self.assertEqual(lines, expected) + def test_resources(self): """Ensure RESOURCE_FILES is handled properly.""" env = self._consume('resources', RecursiveMakeBackend) diff --git a/python/mozbuild/mozbuild/test/frontend/data/generated-files/moz.build b/python/mozbuild/mozbuild/test/frontend/data/generated-files/moz.build new file mode 100644 index 000000000000..f1a60317242d --- /dev/null +++ b/python/mozbuild/mozbuild/test/frontend/data/generated-files/moz.build @@ -0,0 +1,5 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# Any copyright is dedicated to the Public Domain. +# http://creativecommons.org/publicdomain/zero/1.0/ + +GENERATED_FILES += [ 'bar.c', 'foo.c' ] diff --git a/python/mozbuild/mozbuild/test/frontend/test_emitter.py b/python/mozbuild/mozbuild/test/frontend/test_emitter.py index 455b707e11ac..05e595f70137 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py +++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py @@ -14,6 +14,7 @@ from mozbuild.frontend.data import ( Defines, DirectoryTraversal, Exports, + GeneratedFile, GeneratedInclude, GeneratedSources, HostSources, @@ -182,6 +183,18 @@ class TestEmitterBasic(unittest.TestCase): self.assertEqual(wanted, variables) self.maxDiff = maxDiff + def test_generated_files(self): + reader = self.reader('generated-files') + objs = self.read_topsrcdir(reader) + + self.assertEqual(len(objs), 2) + for o in objs: + self.assertIsInstance(o, GeneratedFile) + + expected = ['bar.c', 'foo.c'] + for o, expected_filename in zip(objs, expected): + self.assertEqual(o.filename, expected_filename) + def test_exports(self): reader = self.reader('exports') objs = self.read_topsrcdir(reader) From 3ff1820ae5e5a150f296f207884fb5ae7dd417b0 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Tue, 16 Dec 2014 15:13:27 -0500 Subject: [PATCH 052/115] Bug 883954 - part 2 - add support for defining generating scripts for GENERATED_FILES; r=gps Now that we have proper moz.build objects for GENERATED_FILES, we can add 'script' flags and 'args' flags in moz.build for select GENERATED_FILES. We restrict 'args' to being filenames for ease of implementing checks for file existence, and many (all?) of the examples of file generation throughout the tree don't need arbitrary strings or Python data. --- .../mozbuild/mozbuild/action/file_generate.py | 50 +++++++++++++++++++ .../mozbuild/backend/recursivemake.py | 9 +++- python/mozbuild/mozbuild/frontend/context.py | 33 ++++++++++-- python/mozbuild/mozbuild/frontend/data.py | 10 ++-- python/mozbuild/mozbuild/frontend/emitter.py | 24 ++++++++- .../backend/data/generated-files/foo-data | 0 .../data/generated-files/generate-bar.py | 0 .../data/generated-files/generate-foo.py | 0 .../backend/data/generated-files/moz.build | 9 +++- .../test/backend/test_recursivemake.py | 8 +++ .../data/generated-files-no-inputs/moz.build | 9 ++++ .../data/generated-files-no-inputs/script.py | 0 .../moz.build | 8 +++ .../script.rb | 0 .../data/generated-files-no-script/moz.build | 8 +++ .../mozbuild/test/frontend/test_emitter.py | 20 +++++++- 16 files changed, 177 insertions(+), 11 deletions(-) create mode 100644 python/mozbuild/mozbuild/action/file_generate.py create mode 100644 python/mozbuild/mozbuild/test/backend/data/generated-files/foo-data create mode 100644 python/mozbuild/mozbuild/test/backend/data/generated-files/generate-bar.py create mode 100644 python/mozbuild/mozbuild/test/backend/data/generated-files/generate-foo.py create mode 100644 python/mozbuild/mozbuild/test/frontend/data/generated-files-no-inputs/moz.build create mode 100644 python/mozbuild/mozbuild/test/frontend/data/generated-files-no-inputs/script.py create mode 100644 python/mozbuild/mozbuild/test/frontend/data/generated-files-no-python-script/moz.build create mode 100644 python/mozbuild/mozbuild/test/frontend/data/generated-files-no-python-script/script.rb create mode 100644 python/mozbuild/mozbuild/test/frontend/data/generated-files-no-script/moz.build diff --git a/python/mozbuild/mozbuild/action/file_generate.py b/python/mozbuild/mozbuild/action/file_generate.py new file mode 100644 index 000000000000..bddf9dbc5345 --- /dev/null +++ b/python/mozbuild/mozbuild/action/file_generate.py @@ -0,0 +1,50 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Given a Python script and arguments describing the output file, and +# the arguments that can be used to generate the output file, call the +# script's |main| method with appropriate arguments. + +from __future__ import print_function +import argparse +import imp +import os +import sys +import traceback + +from mozbuild.util import FileAvoidWrite + +def main(argv): + parser = argparse.ArgumentParser('Generate a file from a Python script', + add_help=False) + parser.add_argument('python_script', metavar='python-script', type=str, + help='The Python script to run') + parser.add_argument('output_file', metavar='output-file', type=str, + help='The file to generate') + parser.add_argument('additional_arguments', metavar='arg', nargs='*', + help="Additional arguments to the script's main() method") + + args = parser.parse_args(argv) + + script = args.python_script + with open(script, 'r') as fh: + module = imp.load_module('script', fh, script, + ('.py', 'r', imp.PY_SOURCE)) + if not hasattr(module, 'main'): + print('Error: script "{0}" is missing a main method'.format(script), + file=sys.stderr) + return 1 + + ret = 1 + try: + with FileAvoidWrite(args.output_file) as output: + ret = module.main(output, *args.additional_arguments) + except IOError as e: + print('Error opening file "{0}"'.format(e.filename), file=sys.stderr) + traceback.print_exc() + return 1 + return ret + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py index a3e15bc5aadf..0c4eb38d7572 100644 --- a/python/mozbuild/mozbuild/backend/recursivemake.py +++ b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -406,7 +406,14 @@ class RecursiveMakeBackend(CommonBackend): self._process_exports(obj, obj.exports, backend_file) elif isinstance(obj, GeneratedFile): - backend_file.write('GENERATED_FILES += %s\n' % obj.filename) + backend_file.write('GENERATED_FILES += %s\n' % obj.output) + if obj.script: + backend_file.write("""{output}: {script}{inputs} +\t$(call py_action,file_generate,{script} {output}{inputs}) + +""".format(output=obj.output, + inputs=' ' + ' '.join(obj.inputs) if obj.inputs else '', + script=obj.script)) elif isinstance(obj, TestHarnessFiles): self._process_test_harness_files(obj, backend_file) diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py index 393541b227f3..368540eb173e 100644 --- a/python/mozbuild/mozbuild/frontend/context.py +++ b/python/mozbuild/mozbuild/frontend/context.py @@ -444,12 +444,37 @@ VARIABLES = { and reduce the debug info size. """, None), - 'GENERATED_FILES': (StrictOrderingOnAppendList, list, + 'GENERATED_FILES': (StrictOrderingOnAppendListWithFlagsFactory({ + 'script': unicode, + 'inputs': list }), list, """Generic generated files. - This variable contains a list of generate files for the build system - to generate at export time. The rules for those files still live in - Makefile.in. + This variable contains a list of files for the build system to + generate at export time. The generation method may be declared + with optional ``script`` and ``inputs`` flags on individual entries. + If the optional ``script`` flag is not present on an entry, it + is assumed that rules for generating the file are present in + the associated Makefile.in. + + Example:: + + GENERATED_FILES += ['bar.c', 'baz.c', 'foo.c'] + bar = GENERATED_FILES['bar.c'] + bar.script = 'generate.py' + bar.inputs = ['datafile-for-bar'] + foo = GENERATED_FILES['foo.c'] + foo.script = 'generate.py' + foo.inputs = ['datafile-for-foo'] + + This definition will generate bar.c by calling the main method of + generate.py with a open (for writing) file object for bar.c, and + the string ``datafile-for-bar``. In a similar fashion, the main + method of generate.py will also be called with an open + (for writing) file object for foo.c and the string + ``datafile-for-foo``. Please note that only string arguments are + supported for passing to scripts, and that all arguments provided + to the script should be filenames relative to the directory in which + the moz.build file is located. """, 'export'), 'DEFINES': (OrderedDict, dict, diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py index 90e889d73efc..d3e6970b2bec 100644 --- a/python/mozbuild/mozbuild/frontend/data.py +++ b/python/mozbuild/mozbuild/frontend/data.py @@ -857,12 +857,16 @@ class GeneratedFile(ContextDerived): """Represents a generated file.""" __slots__ = ( - 'filename', + 'script', + 'output', + 'inputs', ) - def __init__(self, context, filename): + def __init__(self, context, script, output, inputs): ContextDerived.__init__(self, context) - self.filename = filename + self.script = script + self.output = output + self.inputs = inputs class ClassPathEntry(object): diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index 06690edcf6eb..6141f7a88fb1 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -521,7 +521,29 @@ class TreeMetadataEmitter(LoggingMixin): generated_files = context.get('GENERATED_FILES') if generated_files: for f in generated_files: - yield GeneratedFile(context, f) + flags = generated_files[f] + output = f + if flags.script: + script = mozpath.join(context.srcdir, flags.script) + inputs = [mozpath.join(context.srcdir, i) for i in flags.inputs] + + if not os.path.exists(script): + raise SandboxValidationError( + 'Script for generating %s does not exist: %s' + % (f, script), context) + if os.path.splitext(script)[1] != '.py': + raise SandboxValidationError( + 'Script for generating %s does not end in .py: %s' + % (f, script), context) + for i in inputs: + if not os.path.exists(i): + raise SandboxValidationError( + 'Input for generating %s does not exist: %s' + % (f, i), context) + else: + script = None + inputs = [] + yield GeneratedFile(context, script, output, inputs) test_harness_files = context.get('TEST_HARNESS_FILES') if test_harness_files: diff --git a/python/mozbuild/mozbuild/test/backend/data/generated-files/foo-data b/python/mozbuild/mozbuild/test/backend/data/generated-files/foo-data new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/mozbuild/mozbuild/test/backend/data/generated-files/generate-bar.py b/python/mozbuild/mozbuild/test/backend/data/generated-files/generate-bar.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/mozbuild/mozbuild/test/backend/data/generated-files/generate-foo.py b/python/mozbuild/mozbuild/test/backend/data/generated-files/generate-foo.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/mozbuild/mozbuild/test/backend/data/generated-files/moz.build b/python/mozbuild/mozbuild/test/backend/data/generated-files/moz.build index f1a60317242d..e377cb6763b0 100644 --- a/python/mozbuild/mozbuild/test/backend/data/generated-files/moz.build +++ b/python/mozbuild/mozbuild/test/backend/data/generated-files/moz.build @@ -2,4 +2,11 @@ # Any copyright is dedicated to the Public Domain. # http://creativecommons.org/publicdomain/zero/1.0/ -GENERATED_FILES += [ 'bar.c', 'foo.c' ] +GENERATED_FILES += [ 'bar.c', 'foo.c', 'quux.c' ] + +bar = GENERATED_FILES['bar.c'] +bar.script = 'generate-bar.py' + +foo = GENERATED_FILES['foo.c'] +foo.script = 'generate-foo.py' +foo.inputs = ['foo-data'] diff --git a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py index 18b5f3c8c601..d733325c9afc 100644 --- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py +++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py @@ -378,9 +378,17 @@ class TestRecursiveMakeBackend(BackendTester): expected = [ 'GENERATED_FILES += bar.c', + 'bar.c: %s/generate-bar.py' % env.topsrcdir, + '$(call py_action,file_generate,%s/generate-bar.py bar.c)' % env.topsrcdir, + '', 'GENERATED_FILES += foo.c', + 'foo.c: %s/generate-foo.py %s/foo-data' % (env.topsrcdir, env.topsrcdir), + '$(call py_action,file_generate,%s/generate-foo.py foo.c %s/foo-data)' % (env.topsrcdir, env.topsrcdir), + '', + 'GENERATED_FILES += quux.c', ] + self.maxDiff = None self.assertEqual(lines, expected) def test_resources(self): diff --git a/python/mozbuild/mozbuild/test/frontend/data/generated-files-no-inputs/moz.build b/python/mozbuild/mozbuild/test/frontend/data/generated-files-no-inputs/moz.build new file mode 100644 index 000000000000..e2ce5c9b7b86 --- /dev/null +++ b/python/mozbuild/mozbuild/test/frontend/data/generated-files-no-inputs/moz.build @@ -0,0 +1,9 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# Any copyright is dedicated to the Public Domain. +# http://creativecommons.org/publicdomain/zero/1.0/ + +GENERATED_FILES += ['bar.c', 'foo.c'] + +foo = GENERATED_FILES['foo.c'] +foo.script = 'script.py' +foo.inputs = ['datafile'] diff --git a/python/mozbuild/mozbuild/test/frontend/data/generated-files-no-inputs/script.py b/python/mozbuild/mozbuild/test/frontend/data/generated-files-no-inputs/script.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/mozbuild/mozbuild/test/frontend/data/generated-files-no-python-script/moz.build b/python/mozbuild/mozbuild/test/frontend/data/generated-files-no-python-script/moz.build new file mode 100644 index 000000000000..cb658e107193 --- /dev/null +++ b/python/mozbuild/mozbuild/test/frontend/data/generated-files-no-python-script/moz.build @@ -0,0 +1,8 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# Any copyright is dedicated to the Public Domain. +# http://creativecommons.org/publicdomain/zero/1.0/ + +GENERATED_FILES += ['bar.c', 'foo.c'] + +bar = GENERATED_FILES['bar.c'] +bar.script = 'script.rb' diff --git a/python/mozbuild/mozbuild/test/frontend/data/generated-files-no-python-script/script.rb b/python/mozbuild/mozbuild/test/frontend/data/generated-files-no-python-script/script.rb new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/python/mozbuild/mozbuild/test/frontend/data/generated-files-no-script/moz.build b/python/mozbuild/mozbuild/test/frontend/data/generated-files-no-script/moz.build new file mode 100644 index 000000000000..95c2339c86d2 --- /dev/null +++ b/python/mozbuild/mozbuild/test/frontend/data/generated-files-no-script/moz.build @@ -0,0 +1,8 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# Any copyright is dedicated to the Public Domain. +# http://creativecommons.org/publicdomain/zero/1.0/ + +GENERATED_FILES += [ 'bar.c', 'foo.c' ] + +bar = GENERATED_FILES['bar.c'] +bar.script = 'nonexistent-script.py' diff --git a/python/mozbuild/mozbuild/test/frontend/test_emitter.py b/python/mozbuild/mozbuild/test/frontend/test_emitter.py index 05e595f70137..4d6300e7bd2e 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py +++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py @@ -193,7 +193,25 @@ class TestEmitterBasic(unittest.TestCase): expected = ['bar.c', 'foo.c'] for o, expected_filename in zip(objs, expected): - self.assertEqual(o.filename, expected_filename) + self.assertEqual(o.output, expected_filename) + + def test_generated_files_no_script(self): + reader = self.reader('generated-files-no-script') + with self.assertRaisesRegexp(SandboxValidationError, + 'Script for generating bar.c does not exist'): + objs = self.read_topsrcdir(reader) + + def test_generated_files_no_inputs(self): + reader = self.reader('generated-files-no-inputs') + with self.assertRaisesRegexp(SandboxValidationError, + 'Input for generating foo.c does not exist'): + objs = self.read_topsrcdir(reader) + + def test_generated_files_no_python_script(self): + reader = self.reader('generated-files-no-python-script') + with self.assertRaisesRegexp(SandboxValidationError, + 'Script for generating bar.c does not end in .py'): + objs = self.read_topsrcdir(reader) def test_exports(self): reader = self.reader('exports') From 2947b8b43fb096ab3a564a885d197645767b7407 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Tue, 16 Dec 2014 15:15:14 -0500 Subject: [PATCH 053/115] Bug 883954 - part 3 - build etld_data.inc using new GENERATED_FILES functionality; r=gps As a proof-of-usefulness, let's change the build process for etld_data.inc to write out the rules generating it automatically through moz.build. --- netwerk/dns/Makefile.in | 11 ----------- netwerk/dns/moz.build | 3 +++ netwerk/dns/prepare_tlds.py | 13 +++++-------- 3 files changed, 8 insertions(+), 19 deletions(-) delete mode 100644 netwerk/dns/Makefile.in diff --git a/netwerk/dns/Makefile.in b/netwerk/dns/Makefile.in deleted file mode 100644 index 1cacbd710be3..000000000000 --- a/netwerk/dns/Makefile.in +++ /dev/null @@ -1,11 +0,0 @@ -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -include $(topsrcdir)/config/rules.mk - -# Generate the include file containing compact, static definitions -# for effective TLD data. -etld_data.inc: $(srcdir)/prepare_tlds.py $(srcdir)/effective_tld_names.dat - $(PYTHON) $(srcdir)/prepare_tlds.py $(srcdir)/effective_tld_names.dat > etld_data.inc diff --git a/netwerk/dns/moz.build b/netwerk/dns/moz.build index 1c4f11369da4..92d20f5be69b 100644 --- a/netwerk/dns/moz.build +++ b/netwerk/dns/moz.build @@ -59,6 +59,9 @@ FINAL_LIBRARY = 'xul' GENERATED_FILES = [ 'etld_data.inc', ] +etld_data = GENERATED_FILES['etld_data.inc'] +etld_data.script = 'prepare_tlds.py' +etld_data.inputs = ['effective_tld_names.dat'] # need to include etld_data.inc LOCAL_INCLUDES += [ diff --git a/netwerk/dns/prepare_tlds.py b/netwerk/dns/prepare_tlds.py index 782b8c80227e..6ddf8d63a14d 100644 --- a/netwerk/dns/prepare_tlds.py +++ b/netwerk/dns/prepare_tlds.py @@ -95,11 +95,11 @@ class EffectiveTLDEntry: # DO EVERYTHING # ################# -def main(): +def main(output, effective_tld_filename): """ - argv[1] is the effective TLD file to parse. + effective_tld_filename is the effective TLD file to parse. A C++ array of { domain, exception, wild } entries representing the - eTLD file is then printed to stdout. + eTLD file is then printed to output. """ def boolStr(b): @@ -107,10 +107,7 @@ def main(): return "true" return "false" - for etld in getEffectiveTLDs(sys.argv[1]): + for etld in getEffectiveTLDs(effective_tld_filename): exception = boolStr(etld.exception()) wild = boolStr(etld.wild()) - print 'ETLD_ENTRY("%s", %s, %s)' % (etld.domain(), exception, wild) - -if __name__ == '__main__': - main() + output.write('ETLD_ENTRY("%s", %s, %s)\n' % (etld.domain(), exception, wild)) From 746235eb65a804382d00ce13f1b5a68e73f4c193 Mon Sep 17 00:00:00 2001 From: Alex Henrie Date: Mon, 16 Feb 2015 16:00:32 -0700 Subject: [PATCH 054/115] Bug 694870 - Only support GIO in Linux file and protocol handler. r=roc, r=karlt --- uriloader/exthandler/unix/nsGNOMERegistry.cpp | 130 +++++------------- uriloader/exthandler/unix/nsMIMEInfoUnix.cpp | 60 +++----- .../exthandler/unix/nsOSHelperAppService.cpp | 36 ++--- 3 files changed, 59 insertions(+), 167 deletions(-) diff --git a/uriloader/exthandler/unix/nsGNOMERegistry.cpp b/uriloader/exthandler/unix/nsGNOMERegistry.cpp index 3adc66d34774..fd5b5792bde9 100644 --- a/uriloader/exthandler/unix/nsGNOMERegistry.cpp +++ b/uriloader/exthandler/unix/nsGNOMERegistry.cpp @@ -6,97 +6,50 @@ #include "nsGNOMERegistry.h" #include "nsString.h" #include "nsIComponentManager.h" -#include "nsIFile.h" #include "nsMIMEInfoUnix.h" #include "nsAutoPtr.h" -#include "nsIGConfService.h" -#include "nsIGnomeVFSService.h" #include "nsIGIOService.h" -#ifdef MOZ_WIDGET_GTK -#include -#include -#endif - /* static */ bool nsGNOMERegistry::HandlerExists(const char *aProtocolScheme) { nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); - nsCOMPtr gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID); - if (giovfs) { - nsCOMPtr app; - if (NS_FAILED(giovfs->GetAppForURIScheme(nsDependentCString(aProtocolScheme), - getter_AddRefs(app)))) - return false; - else - return true; - } else if (gconf) { - bool isEnabled; - nsAutoCString handler; - if (NS_FAILED(gconf->GetAppForProtocol(nsDependentCString(aProtocolScheme), &isEnabled, handler))) - return false; - - return isEnabled; + if (!giovfs) { + return false; } - return false; + nsCOMPtr app; + return NS_SUCCEEDED(giovfs->GetAppForURIScheme(nsDependentCString(aProtocolScheme), + getter_AddRefs(app))); } // XXX Check HandlerExists() before calling LoadURL. -// -// If there is not a registered handler for the protocol, gnome_url_show() -// falls back to using gnomevfs modules. See bug 389632. We don't want -// this fallback to happen as we are not sure of the safety of all gnomevfs -// modules and MIME-default applications. (gnomevfs should be handled in -// nsGnomeVFSProtocolHandler.) /* static */ nsresult nsGNOMERegistry::LoadURL(nsIURI *aURL) { nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); - if (giovfs) - return giovfs->ShowURI(aURL); + if (!giovfs) { + return NS_ERROR_FAILURE; + } - nsCOMPtr gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); - if (gnomevfs) - return gnomevfs->ShowURI(aURL); - - return NS_ERROR_FAILURE; + return giovfs->ShowURI(aURL); } /* static */ void nsGNOMERegistry::GetAppDescForScheme(const nsACString& aScheme, nsAString& aDesc) { - nsCOMPtr gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID); nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); - if (!gconf && !giovfs) + if (!giovfs) return; nsAutoCString name; - if (giovfs) { - nsCOMPtr app; - if (NS_FAILED(giovfs->GetAppForURIScheme(aScheme, getter_AddRefs(app)))) - return; + nsCOMPtr app; + if (NS_FAILED(giovfs->GetAppForURIScheme(aScheme, getter_AddRefs(app)))) + return; - app->GetName(name); - } else { - bool isEnabled; - if (NS_FAILED(gconf->GetAppForProtocol(aScheme, &isEnabled, name))) - return; - - if (!name.IsEmpty()) { - // Try to only provide the executable name, as it is much simpler than with the path and arguments - int32_t firstSpace = name.FindChar(' '); - if (firstSpace != kNotFound) { - name.Truncate(firstSpace); - int32_t lastSlash = name.RFindChar('/'); - if (lastSlash != kNotFound) { - name.Cut(0, lastSlash + 1); - } - } - } - } + app->GetName(name); CopyUTF8toUTF16(name, aDesc); } @@ -107,23 +60,15 @@ nsGNOMERegistry::GetFromExtension(const nsACString& aFileExt) { nsAutoCString mimeType; nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); + if (!giovfs) { + return nullptr; + } - if (giovfs) { - // Get the MIME type from the extension, then call GetFromType to - // fill in the MIMEInfo. - if (NS_FAILED(giovfs->GetMimeTypeFromExtension(aFileExt, mimeType)) || - mimeType.EqualsLiteral("application/octet-stream")) { - return nullptr; - } - } else { - /* Fallback to GnomeVFS */ - nsCOMPtr gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); - if (!gnomevfs) - return nullptr; - - if (NS_FAILED(gnomevfs->GetMimeTypeFromExtension(aFileExt, mimeType)) || - mimeType.EqualsLiteral("application/octet-stream")) - return nullptr; + // Get the MIME type from the extension, then call GetFromType to + // fill in the MIMEInfo. + if (NS_FAILED(giovfs->GetMimeTypeFromExtension(aFileExt, mimeType)) || + mimeType.EqualsLiteral("application/octet-stream")) { + return nullptr; } nsRefPtr mi = GetFromType(mimeType); @@ -144,29 +89,18 @@ nsGNOMERegistry::GetFromType(const nsACString& aMIMEType) nsAutoCString description; nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); - if (giovfs) { - nsCOMPtr gioHandlerApp; - if (NS_FAILED(giovfs->GetAppForMimeType(aMIMEType, getter_AddRefs(gioHandlerApp))) || - !gioHandlerApp) { - return nullptr; - } - gioHandlerApp->GetName(name); - giovfs->GetDescriptionForMimeType(aMIMEType, description); - } else { - /* Fallback to GnomeVFS*/ - nsCOMPtr gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); - if (!gnomevfs) - return nullptr; - - nsCOMPtr gnomeHandlerApp; - if (NS_FAILED(gnomevfs->GetAppForMimeType(aMIMEType, getter_AddRefs(gnomeHandlerApp))) || - !gnomeHandlerApp) { - return nullptr; - } - gnomeHandlerApp->GetName(name); - gnomevfs->GetDescriptionForMimeType(aMIMEType, description); + if (!giovfs) { + return nullptr; } + nsCOMPtr gioHandlerApp; + if (NS_FAILED(giovfs->GetAppForMimeType(aMIMEType, getter_AddRefs(gioHandlerApp))) || + !gioHandlerApp) { + return nullptr; + } + gioHandlerApp->GetName(name); + giovfs->GetDescriptionForMimeType(aMIMEType, description); + mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(name)); mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault); mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description)); diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp index c2be46e4c52f..08fde9060b9e 100644 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp @@ -16,7 +16,6 @@ #include "nsIGIOService.h" #include "nsNetCID.h" #include "nsIIOService.h" -#include "nsIGnomeVFSService.h" #include "nsAutoPtr.h" #ifdef MOZ_ENABLE_DBUS #include "nsDBusHandlerApp.h" @@ -50,7 +49,7 @@ nsMIMEInfoUnix::GetHasDefaultHandler(bool *_retval) *_retval = false; - if (mClass == eProtocolInfo) { + if (mClass == eProtocolInfo) { *_retval = nsGNOMERegistry::HandlerExists(mSchemeOrType.get()); } else { nsRefPtr mimeInfo = nsGNOMERegistry::GetFromType(mSchemeOrType); @@ -104,51 +103,26 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(nsIFile *aFile) #endif nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); + if (!giovfs) { + return NS_ERROR_FAILURE; + } + + // nsGIOMimeApp->Launch wants a URI string instead of local file + nsresult rv; + nsCOMPtr ioservice = do_GetService(NS_IOSERVICE_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr uri; + rv = ioservice->NewFileURI(aFile, getter_AddRefs(uri)); + NS_ENSURE_SUCCESS(rv, rv); nsAutoCString uriSpec; - if (giovfs) { - // nsGIOMimeApp->Launch wants a URI string instead of local file - nsresult rv; - nsCOMPtr ioservice = do_GetService(NS_IOSERVICE_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr uri; - rv = ioservice->NewFileURI(aFile, getter_AddRefs(uri)); - NS_ENSURE_SUCCESS(rv, rv); - uri->GetSpec(uriSpec); - } + uri->GetSpec(uriSpec); - nsCOMPtr gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); - if (giovfs) { - nsCOMPtr app; - if (NS_SUCCEEDED(giovfs->GetAppForMimeType(mSchemeOrType, getter_AddRefs(app))) && app) - return app->Launch(uriSpec); - } else if (gnomevfs) { - /* Fallback to GnomeVFS */ - nsCOMPtr app; - if (NS_SUCCEEDED(gnomevfs->GetAppForMimeType(mSchemeOrType, getter_AddRefs(app))) && app) - return app->Launch(nativePath); - } - - // If we haven't got an app we try to get a valid one by searching for the - // extension mapped type - nsRefPtr mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath); - if (mimeInfo) { - nsAutoCString type; - mimeInfo->GetType(type); - if (giovfs) { - nsCOMPtr app; - if (NS_SUCCEEDED(giovfs->GetAppForMimeType(type, getter_AddRefs(app))) && app) - return app->Launch(uriSpec); - } else if (gnomevfs) { - nsCOMPtr app; - if (NS_SUCCEEDED(gnomevfs->GetAppForMimeType(type, getter_AddRefs(app))) && app) - return app->Launch(nativePath); - } - } - - if (!mDefaultApplication) + nsCOMPtr app; + if (NS_FAILED(giovfs->GetAppForMimeType(mSchemeOrType, getter_AddRefs(app))) || !app) { return NS_ERROR_FILE_NOT_FOUND; + } - return LaunchWithIProcess(mDefaultApplication, nativePath); + return app->Launch(uriSpec); } #if defined(MOZ_ENABLE_CONTENTACTION) diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp index e514ba32df72..9ca76f34ba79 100644 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp @@ -1150,7 +1150,7 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolSch #endif #ifdef MOZ_WIDGET_GTK - // Check the GConf registry for a protocol handler + // Check the GNOME registry for a protocol handler *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme); #endif @@ -1369,22 +1369,6 @@ nsOSHelperAppService::GetFromType(const nsCString& aMIMEType) { NS_LossyConvertUTF16toASCII(handler).get(), NS_LossyConvertUTF16toASCII(mailcap_description).get())); -#ifdef MOZ_WIDGET_GTK - nsRefPtr gnomeInfo; - if (handler.IsEmpty()) { - // No useful data yet. Check the GNOME registry. Unfortunately, newer - // GNOME versions no longer have type-to-extension mappings, so we might - // get back a MIMEInfo without any extensions set. In that case we'll have - // to look in our mime.types files for the extensions. - LOG(("Looking in GNOME registry\n")); - gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType); - if (gnomeInfo && gnomeInfo->HasExtensions()) { - LOG(("Got MIMEInfo from GNOME registry, and it has extensions set\n")); - return gnomeInfo.forget(); - } - } -#endif - // Now look up our extensions nsAutoString extensions, mime_types_description; LookUpExtensionsAndDescription(majorType, @@ -1393,13 +1377,16 @@ nsOSHelperAppService::GetFromType(const nsCString& aMIMEType) { mime_types_description); #ifdef MOZ_WIDGET_GTK - if (gnomeInfo) { - LOG(("Got MIMEInfo from GNOME registry without extensions; setting them " - "to %s\n", NS_LossyConvertUTF16toASCII(extensions).get())); + if (handler.IsEmpty()) { + nsRefPtr gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType); + if (gnomeInfo) { + LOG(("Got MIMEInfo from GNOME registry without extensions; setting them " + "to %s\n", NS_LossyConvertUTF16toASCII(extensions).get())); - NS_ASSERTION(!gnomeInfo->HasExtensions(), "How'd that happen?"); - gnomeInfo->SetFileExtensions(NS_ConvertUTF16toUTF8(extensions)); - return gnomeInfo.forget(); + NS_ASSERTION(!gnomeInfo->HasExtensions(), "How'd that happen?"); + gnomeInfo->SetFileExtensions(NS_ConvertUTF16toUTF8(extensions)); + return gnomeInfo.forget(); + } } #endif @@ -1526,9 +1513,6 @@ nsOSHelperAppService::GetProtocolHandlerInfoFromOS(const nsACString &aScheme, { NS_ASSERTION(!aScheme.IsEmpty(), "No scheme was specified!"); - // We must check that a registered handler exists so that gnome_url_show - // doesn't fallback to gnomevfs. - // See nsGNOMERegistry::LoadURL and bug 389632. nsresult rv = OSProtocolHandlerExists(nsPromiseFlatCString(aScheme).get(), found); if (NS_FAILED(rv)) From 7258683034718f775977cf3e4dfd3b6e4a04dc52 Mon Sep 17 00:00:00 2001 From: Douglas Crosher Date: Wed, 18 Feb 2015 20:29:51 +1100 Subject: [PATCH 055/115] Bug 1130827 - Odin: Use SIMD load/store for the fbird test now that they are implemented. r=bbouvier --- js/src/jit-test/tests/asm.js/simd-fbirds.js | 30 ++++++--------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/js/src/jit-test/tests/asm.js/simd-fbirds.js b/js/src/jit-test/tests/asm.js/simd-fbirds.js index 6ef528ef2c72..8dc9e7a21a59 100644 --- a/js/src/jit-test/tests/asm.js/simd-fbirds.js +++ b/js/src/jit-test/tests/asm.js/simd-fbirds.js @@ -44,15 +44,13 @@ function getActualBirds() { var code = ` "use asm"; var toF = global.Math.fround; + var u8 = new global.Uint8Array(buffer); var f32 = new global.Float32Array(buffer); const maxBirds = 100000; const maxBirdsx4 = 400000; - const maxBirdsx4Plus4 = 400004; - const maxBirdsx4Plus8 = 400008; - const maxBirdsx4Plus12 = 400012; const maxBirdsx8 = 800000; const accelMask = 0x3c; - const mk2 = 0x000ffffc; + const mk4 = 0x000ffff0; const getMaxPos = 1000.0; const getAccelDataSteps = imp.accelDataSteps | 0; @@ -68,6 +66,8 @@ var code = ` var f4mul = f4.mul; var f4greaterThan = f4.greaterThan; var f4splat = f4.splat; + var f4load = f4.load; + var f4store = f4.store; const zerox4 = f4(0.0,0.0,0.0,0.0); @@ -110,15 +110,8 @@ var code = ` for (i = 0; (i | 0) < (len | 0); i = (i + 16) | 0) { accelIndex = 0; - // Work around unimplemented Float32x4Array - newPosx4 = f4(toF(f32[(i & mk2) >> 2]), - toF(f32[(i & mk2) + 4 >> 2]), - toF(f32[(i & mk2) + 8 >> 2]), - toF(f32[(i & mk2) + 12 >> 2])); - newVelx4 = f4(toF(f32[(i & mk2) + maxBirdsx4 >> 2]), - toF(f32[(i & mk2) + maxBirdsx4Plus4 >> 2]), - toF(f32[(i & mk2) + maxBirdsx4Plus8 >> 2]), - toF(f32[(i & mk2) + maxBirdsx4Plus12 >> 2])); + newPosx4 = f4load(u8, i & mk4); + newVelx4 = f4load(u8, (i & mk4) + maxBirdsx4); for (a = 0; (a | 0) < (steps | 0); a = (a + 1) | 0) { accel = toF(f32[(accelIndex & accelMask) + maxBirdsx8 >> 2]); accelx4 = f4splat(accel); @@ -135,15 +128,8 @@ var code = ` newVelx4 = f4select(cmpx4, newVelTruex4, newVelx4); } } - // Work around unimplemented Float32x4Array - f32[(i & mk2) >> 2] = newPosx4.x; - f32[(i & mk2) + 4 >> 2] = newPosx4.y; - f32[(i & mk2) + 8 >> 2] = newPosx4.z; - f32[(i & mk2) + 12 >> 2] = newPosx4.w; - f32[(i & mk2) + maxBirdsx4 >> 2] = newVelx4.x; - f32[(i & mk2) + maxBirdsx4Plus4 >> 2] = newVelx4.y; - f32[(i & mk2) + maxBirdsx4Plus8 >> 2] = newVelx4.z; - f32[(i & mk2) + maxBirdsx4Plus12 >> 2] = newVelx4.w; + f4store(u8, i & mk4, newPosx4); + f4store(u8, (i & mk4) + maxBirdsx4, newVelx4); } } From c39aefe5a89c3e7ff372f51c80dccfd503fbd72d Mon Sep 17 00:00:00 2001 From: Dragana Damjanovic Date: Wed, 18 Feb 2015 06:35:00 -0500 Subject: [PATCH 056/115] Bug 1131557 - Serve multiple xpcom events in one poll iteration. r=mcmanus --- modules/libpref/init/all.js | 6 +++ netwerk/base/nsSocketTransportService2.cpp | 61 ++++++++++++++++++++-- netwerk/base/nsSocketTransportService2.h | 7 +++ 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 5b7e03a92f09..a041c0f5919c 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1359,6 +1359,12 @@ pref("network.http.enforce-framing.http1", false); pref("network.ftp.data.qos", 0); pref("network.ftp.control.qos", 0); +// If this pref is false only one xpcom event will be served per poll +// iteration. This is the original behavior. +// If it is true multiple events will be served. +pref("network.sts.serve_multiple_events_per_poll_iteration", true); +// The max time to spend on xpcom events between two polls in ms. +pref("network.sts.max_time_for_events_between_two_polls", 100); // // 2147483647 == PR_INT32_MAX == ~2 GB diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp index 2bdc7b8e55b3..cad179476578 100644 --- a/netwerk/base/nsSocketTransportService2.cpp +++ b/netwerk/base/nsSocketTransportService2.cpp @@ -40,6 +40,8 @@ PRThread *gSocketThread = nullptr; #define SOCKET_LIMIT_TARGET 550U #define SOCKET_LIMIT_MIN 50U #define BLIP_INTERVAL_PREF "network.activity.blipIntervalMilliseconds" +#define SERVE_MULTIPLE_EVENTS_PREF "network.sts.serve_multiple_events_per_poll_iteration" +#define MAX_TIME_BETWEEN_TWO_POLLS "network.sts.max_time_for_events_between_two_polls" uint32_t nsSocketTransportService::gMaxCount; PRCallOnceType nsSocketTransportService::gMaxCountInitOnce; @@ -67,6 +69,9 @@ nsSocketTransportService::nsSocketTransportService() , mKeepaliveRetryIntervalS(1) , mKeepaliveProbeCount(kDefaultTCPKeepCount) , mKeepaliveEnabledPref(false) + , mServeMultipleEventsPerPollIter(true) + , mServingPendingQueue(false) + , mMaxTimePerPollIter(100) , mProbedMaxCount(false) { #if defined(PR_LOGGING) @@ -481,6 +486,8 @@ nsSocketTransportService::Init() tmpPrefService->AddObserver(KEEPALIVE_IDLE_TIME_PREF, this, false); tmpPrefService->AddObserver(KEEPALIVE_RETRY_INTERVAL_PREF, this, false); tmpPrefService->AddObserver(KEEPALIVE_PROBE_COUNT_PREF, this, false); + tmpPrefService->AddObserver(SERVE_MULTIPLE_EVENTS_PREF, this, false); + tmpPrefService->AddObserver(MAX_TIME_BETWEEN_TWO_POLLS, this, false); } UpdatePrefs(); @@ -686,6 +693,12 @@ nsSocketTransportService::AfterProcessNextEvent(nsIThreadInternal* thread, return NS_OK; } +void +nsSocketTransportService::MarkTheLastElementOfPendingQueue() +{ + mServingPendingQueue = false; +} + #ifdef MOZ_NUWA_PROCESS #include "ipc/Nuwa.h" #endif @@ -730,15 +743,39 @@ nsSocketTransportService::Run() // If there are pending events for this thread then // DoPollIteration() should service the network without blocking. DoPollIteration(!pendingEvents); - + // If nothing was pending before the poll, it might be now - if (!pendingEvents) + if (!pendingEvents) { thread->HasPendingEvents(&pendingEvents); + } if (pendingEvents) { - NS_ProcessNextEvent(thread); - pendingEvents = false; - thread->HasPendingEvents(&pendingEvents); + if (mServeMultipleEventsPerPollIter) { + if (!mServingPendingQueue) { + nsresult rv = Dispatch(NS_NewRunnableMethod(this, + &nsSocketTransportService::MarkTheLastElementOfPendingQueue), + nsIEventTarget::DISPATCH_NORMAL); + if (NS_FAILED(rv)) { + NS_WARNING("Could not dispatch a new event on the " + "socket thread."); + } else { + mServingPendingQueue = true; + } + } + TimeStamp eventQueueStart = TimeStamp::NowLoRes(); + do { + NS_ProcessNextEvent(thread); + pendingEvents = false; + thread->HasPendingEvents(&pendingEvents); + } while (pendingEvents && mServingPendingQueue && + ((TimeStamp::NowLoRes() - + eventQueueStart).ToMilliseconds() < + mMaxTimePerPollIter)); + } else { + NS_ProcessNextEvent(thread); + pendingEvents = false; + thread->HasPendingEvents(&pendingEvents); + } } } while (pendingEvents); @@ -982,6 +1019,20 @@ nsSocketTransportService::UpdatePrefs() mKeepaliveEnabledPref = keepaliveEnabled; OnKeepaliveEnabledPrefChange(); } + + bool serveMultiplePref = false; + rv = tmpPrefService->GetBoolPref(SERVE_MULTIPLE_EVENTS_PREF, + &serveMultiplePref); + if (NS_SUCCEEDED(rv)) { + mServeMultipleEventsPerPollIter = serveMultiplePref; + } + + int32_t maxTimePref; + rv = tmpPrefService->GetIntPref(MAX_TIME_BETWEEN_TWO_POLLS, + &maxTimePref); + if (NS_SUCCEEDED(rv) && maxTimePref >= 0) { + mMaxTimePerPollIter = maxTimePref; + } } return NS_OK; diff --git a/netwerk/base/nsSocketTransportService2.h b/netwerk/base/nsSocketTransportService2.h index 9bc550fe7d11..9e3fff893968 100644 --- a/netwerk/base/nsSocketTransportService2.h +++ b/netwerk/base/nsSocketTransportService2.h @@ -17,6 +17,7 @@ #include "nsIObserver.h" #include "mozilla/Mutex.h" #include "mozilla/net/DashboardTypes.h" +#include "mozilla/Atomics.h" class nsASocketHandler; struct PRPollDesc; @@ -217,6 +218,10 @@ private: // True if TCP keepalive is enabled globally. bool mKeepaliveEnabledPref; + bool mServeMultipleEventsPerPollIter; + mozilla::Atomic mServingPendingQueue; + int32_t mMaxTimePerPollIter; + void OnKeepaliveEnabledPrefChange(); void NotifyKeepaliveEnabledPrefChange(SocketContext *sock); @@ -233,6 +238,8 @@ private: void DetachSocketWithGuard(bool aGuardLocals, SocketContext *socketList, int32_t index); + + void MarkTheLastElementOfPendingQueue(); }; extern nsSocketTransportService *gSocketTransportService; From abbe8bd95b52cf868cba2e823286c3d1f9c62b47 Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Wed, 18 Feb 2015 08:08:36 -0700 Subject: [PATCH 057/115] Bug 1133254 - Dehandlify shape-updating object methods, allow setting multiple flags on an object at once, r=terrence. --- js/src/jsfun.cpp | 4 +- js/src/jsobj.cpp | 10 ++-- js/src/jsobj.h | 22 ++++--- js/src/vm/GlobalObject.cpp | 4 +- js/src/vm/NativeObject-inl.h | 7 +-- js/src/vm/NativeObject.cpp | 111 +++++++++++++++++------------------ js/src/vm/NativeObject.h | 23 +++----- js/src/vm/ObjectGroup.cpp | 5 +- js/src/vm/Shape.cpp | 28 ++++----- js/src/vm/Shape.h | 4 +- js/src/vm/UnboxedObject.cpp | 2 +- 11 files changed, 102 insertions(+), 118 deletions(-) diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index 8498b9a5a468..9c7bd028dff3 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -1347,10 +1347,10 @@ JSFunction::initBoundFunction(JSContext *cx, HandleObject target, HandleValue th if (!self->toDictionaryMode(cx)) return false; - if (!self->setFlag(cx, BaseShape::BOUND_FUNCTION)) + if (!self->JSObject::setFlags(cx, BaseShape::BOUND_FUNCTION)) return false; - if (!NativeObject::setSlotSpan(cx, self, BOUND_FUNCTION_RESERVED_SLOTS + argslen)) + if (!self->setSlotSpan(cx, BOUND_FUNCTION_RESERVED_SLOTS + argslen)) return false; self->setSlot(JSSLOT_BOUND_FUNCTION_TARGET, ObjectValue(*target)); diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index b7344fd830b9..d620ee18a6d1 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -1038,7 +1038,7 @@ js::SetIntegrityLevel(JSContext *cx, HandleObject obj, IntegrityLevel level) } MOZ_ASSERT(nobj->lastProperty()->slotSpan() == last->slotSpan()); - JS_ALWAYS_TRUE(NativeObject::setLastProperty(cx, nobj, last)); + JS_ALWAYS_TRUE(nobj->setLastProperty(cx, last)); } else { RootedId id(cx); Rooted desc(cx); @@ -1845,7 +1845,7 @@ js::DeepCloneObjectLiteral(JSContext *cx, HandleNativeObject obj, NewObjectKind MOZ_ASSERT(!obj->hasPrivate()); RootedShape shape(cx, obj->lastProperty()); size_t span = shape->slotSpan(); - clone->setLastProperty(cx, clone, shape); + clone->setLastProperty(cx, shape); for (size_t i = 0; i < span; i++) { v = obj->getSlot(i); if (v.isObject()) { @@ -2137,7 +2137,7 @@ js::CloneObjectLiteral(JSContext *cx, HandleObject parent, HandleObject srcObj) RootedShape newShape(cx, ReshapeForParentAndAllocKind(cx, srcObj->lastProperty(), TaggedProto(proto), parent, kind)); - if (!newShape || !NativeObject::setLastProperty(cx, res, newShape)) + if (!newShape || !res->setLastProperty(cx, newShape)) return nullptr; return res; @@ -3139,7 +3139,7 @@ js::PreventExtensions(JSContext *cx, HandleObject obj, bool *succeeded) return false; *succeeded = true; - return obj->setFlag(cx, BaseShape::NOT_EXTENSIBLE, JSObject::GENERATE_SHAPE); + return obj->setFlags(cx, BaseShape::NOT_EXTENSIBLE, JSObject::GENERATE_SHAPE); } bool @@ -3234,7 +3234,7 @@ js::SetImmutablePrototype(ExclusiveContext *cx, HandleObject obj, bool *succeede return Proxy::setImmutablePrototype(cx->asJSContext(), obj, succeeded); } - if (!obj->setFlag(cx, BaseShape::IMMUTABLE_PROTOTYPE)) + if (!obj->setFlags(cx, BaseShape::IMMUTABLE_PROTOTYPE)) return false; *succeeded = true; return true; diff --git a/js/src/jsobj.h b/js/src/jsobj.h index c78aa41fbd77..7df9512292da 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -189,16 +189,14 @@ class JSObject : public js::gc::Cell inline void setInitialSlotsMaybeNonNative(js::HeapSlot *slots); inline void setInitialElementsMaybeNonNative(js::HeapSlot *elements); - protected: enum GenerateShape { GENERATE_NONE, GENERATE_SHAPE }; - bool setFlag(js::ExclusiveContext *cx, /*BaseShape::Flag*/ uint32_t flag, - GenerateShape generateShape = GENERATE_NONE); + bool setFlags(js::ExclusiveContext *cx, /*BaseShape::Flag*/ uint32_t flags, + GenerateShape generateShape = GENERATE_NONE); - public: /* * An object is a delegate if it is on another object's prototype or scope * chain, and therefore the delegate might be asked implicitly to get or @@ -213,7 +211,7 @@ class JSObject : public js::gc::Cell } bool setDelegate(js::ExclusiveContext *cx) { - return setFlag(cx, js::BaseShape::DELEGATE, GENERATE_SHAPE); + return setFlags(cx, js::BaseShape::DELEGATE, GENERATE_SHAPE); } bool isBoundFunction() const { @@ -226,18 +224,18 @@ class JSObject : public js::gc::Cell return lastProperty()->hasObjectFlag(js::BaseShape::WATCHED); } bool setWatched(js::ExclusiveContext *cx) { - return setFlag(cx, js::BaseShape::WATCHED, GENERATE_SHAPE); + return setFlags(cx, js::BaseShape::WATCHED, GENERATE_SHAPE); } /* See InterpreterFrame::varObj. */ inline bool isQualifiedVarObj(); bool setQualifiedVarObj(js::ExclusiveContext *cx) { - return setFlag(cx, js::BaseShape::QUALIFIED_VAROBJ); + return setFlags(cx, js::BaseShape::QUALIFIED_VAROBJ); } inline bool isUnqualifiedVarObj(); bool setUnqualifiedVarObj(js::ExclusiveContext *cx) { - return setFlag(cx, js::BaseShape::UNQUALIFIED_VAROBJ); + return setFlags(cx, js::BaseShape::UNQUALIFIED_VAROBJ); } /* @@ -250,7 +248,7 @@ class JSObject : public js::gc::Cell return lastProperty()->hasObjectFlag(js::BaseShape::UNCACHEABLE_PROTO); } bool setUncacheableProto(js::ExclusiveContext *cx) { - return setFlag(cx, js::BaseShape::UNCACHEABLE_PROTO, GENERATE_SHAPE); + return setFlags(cx, js::BaseShape::UNCACHEABLE_PROTO, GENERATE_SHAPE); } /* @@ -261,7 +259,7 @@ class JSObject : public js::gc::Cell return lastProperty()->hasObjectFlag(js::BaseShape::HAD_ELEMENTS_ACCESS); } bool setHadElementsAccess(js::ExclusiveContext *cx) { - return setFlag(cx, js::BaseShape::HAD_ELEMENTS_ACCESS); + return setFlags(cx, js::BaseShape::HAD_ELEMENTS_ACCESS); } /* @@ -397,7 +395,7 @@ class JSObject : public js::gc::Cell return lastProperty()->hasObjectFlag(js::BaseShape::ITERATED_SINGLETON); } bool setIteratedSingleton(js::ExclusiveContext *cx) { - return setFlag(cx, js::BaseShape::ITERATED_SINGLETON); + return setFlags(cx, js::BaseShape::ITERATED_SINGLETON); } /* @@ -414,7 +412,7 @@ class JSObject : public js::gc::Cell return lastProperty()->hasObjectFlag(js::BaseShape::NEW_SCRIPT_CLEARED); } bool setNewScriptCleared(js::ExclusiveContext *cx) { - return setFlag(cx, js::BaseShape::NEW_SCRIPT_CLEARED); + return setFlags(cx, js::BaseShape::NEW_SCRIPT_CLEARED); } /* Set a new prototype for an object with a singleton type. */ diff --git a/js/src/vm/GlobalObject.cpp b/js/src/vm/GlobalObject.cpp index 5707cc64029e..d85a13a83c7a 100644 --- a/js/src/vm/GlobalObject.cpp +++ b/js/src/vm/GlobalObject.cpp @@ -614,11 +614,11 @@ GlobalObject::addIntrinsicValue(JSContext *cx, HandleId id, HandleValue value) Rooted base(cx, last->base()->unowned()); StackShape child(base, id, slot, 0, 0); - RootedShape shape(cx, cx->compartment()->propertyTree.getChild(cx, last, child)); + Shape *shape = cx->compartment()->propertyTree.getChild(cx, last, child); if (!shape) return false; - if (!NativeObject::setLastProperty(cx, holder, shape)) + if (!holder->setLastProperty(cx, shape)) return false; holder->setSlot(shape->slot(), value); diff --git a/js/src/vm/NativeObject-inl.h b/js/src/vm/NativeObject-inl.h index cbb82fbd3d92..0af1db08e62d 100644 --- a/js/src/vm/NativeObject-inl.h +++ b/js/src/vm/NativeObject-inl.h @@ -39,9 +39,7 @@ inline void NativeObject::removeLastProperty(ExclusiveContext *cx) { MOZ_ASSERT(canRemoveLastProperty()); - RootedNativeObject self(cx, this); - RootedShape prev(cx, lastProperty()->previous()); - JS_ALWAYS_TRUE(setLastProperty(cx, self, prev)); + JS_ALWAYS_TRUE(setLastProperty(cx, lastProperty()->previous())); } inline bool @@ -335,8 +333,7 @@ CopyInitializerObject(JSContext *cx, HandlePlainObject baseobj, NewObjectKind ne return nullptr; RootedObject metadata(cx, obj->getMetadata()); - RootedShape lastProp(cx, baseobj->lastProperty()); - if (!NativeObject::setLastProperty(cx, obj, lastProp)) + if (!obj->setLastProperty(cx, baseobj->lastProperty())) return nullptr; if (metadata && !JSObject::setMetadata(cx, obj, metadata)) return nullptr; diff --git a/js/src/vm/NativeObject.cpp b/js/src/vm/NativeObject.cpp index fd32b37d68e5..15aea6a6f094 100644 --- a/js/src/vm/NativeObject.cpp +++ b/js/src/vm/NativeObject.cpp @@ -296,56 +296,55 @@ PropDesc::trace(JSTracer *trc) gc::MarkValueRoot(trc, &set_, "PropDesc set"); } -/* static */ inline bool -NativeObject::updateSlotsForSpan(ExclusiveContext *cx, - HandleNativeObject obj, size_t oldSpan, size_t newSpan) +inline bool +NativeObject::updateSlotsForSpan(ExclusiveContext *cx, size_t oldSpan, size_t newSpan) { MOZ_ASSERT(oldSpan != newSpan); - size_t oldCount = dynamicSlotsCount(obj->numFixedSlots(), oldSpan, obj->getClass()); - size_t newCount = dynamicSlotsCount(obj->numFixedSlots(), newSpan, obj->getClass()); + size_t oldCount = dynamicSlotsCount(numFixedSlots(), oldSpan, getClass()); + size_t newCount = dynamicSlotsCount(numFixedSlots(), newSpan, getClass()); if (oldSpan < newSpan) { - if (oldCount < newCount && !growSlots(cx, obj, oldCount, newCount)) + if (oldCount < newCount && !growSlots(cx, oldCount, newCount)) return false; if (newSpan == oldSpan + 1) - obj->initSlotUnchecked(oldSpan, UndefinedValue()); + initSlotUnchecked(oldSpan, UndefinedValue()); else - obj->initializeSlotRange(oldSpan, newSpan - oldSpan); + initializeSlotRange(oldSpan, newSpan - oldSpan); } else { /* Trigger write barriers on the old slots before reallocating. */ - obj->prepareSlotRangeForOverwrite(newSpan, oldSpan); - obj->invalidateSlotRange(newSpan, oldSpan - newSpan); + prepareSlotRangeForOverwrite(newSpan, oldSpan); + invalidateSlotRange(newSpan, oldSpan - newSpan); if (oldCount > newCount) - shrinkSlots(cx, obj, oldCount, newCount); + shrinkSlots(cx, oldCount, newCount); } return true; } -/* static */ bool -NativeObject::setLastProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleShape shape) +bool +NativeObject::setLastProperty(ExclusiveContext *cx, Shape *shape) { - MOZ_ASSERT(!obj->inDictionaryMode()); + MOZ_ASSERT(!inDictionaryMode()); MOZ_ASSERT(!shape->inDictionary()); - MOZ_ASSERT(shape->compartment() == obj->compartment()); - MOZ_ASSERT(shape->numFixedSlots() == obj->numFixedSlots()); - MOZ_ASSERT(shape->getObjectClass() == obj->getClass()); + MOZ_ASSERT(shape->compartment() == compartment()); + MOZ_ASSERT(shape->numFixedSlots() == numFixedSlots()); + MOZ_ASSERT(shape->getObjectClass() == getClass()); - size_t oldSpan = obj->lastProperty()->slotSpan(); + size_t oldSpan = lastProperty()->slotSpan(); size_t newSpan = shape->slotSpan(); if (oldSpan == newSpan) { - obj->shape_ = shape; + shape_ = shape; return true; } - if (!updateSlotsForSpan(cx, obj, oldSpan, newSpan)) + if (!updateSlotsForSpan(cx, oldSpan, newSpan)) return false; - obj->shape_ = shape; + shape_ = shape; return true; } @@ -383,43 +382,42 @@ NativeObject::setLastPropertyMakeNonNative(Shape *shape) shape_ = shape; } -/* static */ void -NativeObject::setLastPropertyMakeNative(ExclusiveContext *cx, HandleNativeObject obj, - HandleShape shape) +void +NativeObject::setLastPropertyMakeNative(ExclusiveContext *cx, Shape *shape) { - MOZ_ASSERT(obj->getClass()->isNative()); - MOZ_ASSERT(!obj->lastProperty()->isNative()); + MOZ_ASSERT(getClass()->isNative()); + MOZ_ASSERT(!lastProperty()->isNative()); MOZ_ASSERT(shape->isNative()); - MOZ_ASSERT(!obj->inDictionaryMode()); + MOZ_ASSERT(!inDictionaryMode()); MOZ_ASSERT(!shape->inDictionary()); - MOZ_ASSERT(shape->compartment() == obj->compartment()); + MOZ_ASSERT(shape->compartment() == compartment()); - obj->shape_ = shape; - obj->slots_ = nullptr; - obj->elements_ = emptyObjectElements; + shape_ = shape; + slots_ = nullptr; + elements_ = emptyObjectElements; size_t oldSpan = shape->numFixedSlots(); size_t newSpan = shape->slotSpan(); - // A failures at this point will leave the object as a mutant, and we + // A failure at this point will leave the object as a mutant, and we // can't recover. - if (oldSpan != newSpan && !updateSlotsForSpan(cx, obj, oldSpan, newSpan)) + if (oldSpan != newSpan && !updateSlotsForSpan(cx, oldSpan, newSpan)) CrashAtUnhandlableOOM("NativeObject::setLastPropertyMakeNative"); } -/* static */ bool -NativeObject::setSlotSpan(ExclusiveContext *cx, HandleNativeObject obj, uint32_t span) +bool +NativeObject::setSlotSpan(ExclusiveContext *cx, uint32_t span) { - MOZ_ASSERT(obj->inDictionaryMode()); + MOZ_ASSERT(inDictionaryMode()); - size_t oldSpan = obj->lastProperty()->base()->slotSpan(); + size_t oldSpan = lastProperty()->base()->slotSpan(); if (oldSpan == span) return true; - if (!updateSlotsForSpan(cx, obj, oldSpan, span)) + if (!updateSlotsForSpan(cx, oldSpan, span)) return false; - obj->lastProperty()->base()->setSlotSpan(span); + lastProperty()->base()->setSlotSpan(span); return true; } @@ -448,11 +446,11 @@ ReallocateSlots(ExclusiveContext *cx, JSObject *obj, HeapSlot *oldSlots, return obj->zone()->pod_realloc(oldSlots, oldCount, newCount); } -/* static */ bool -NativeObject::growSlots(ExclusiveContext *cx, HandleNativeObject obj, uint32_t oldCount, uint32_t newCount) +bool +NativeObject::growSlots(ExclusiveContext *cx, uint32_t oldCount, uint32_t newCount) { MOZ_ASSERT(newCount > oldCount); - MOZ_ASSERT_IF(!obj->is(), newCount >= SLOT_CAPACITY_MIN); + MOZ_ASSERT_IF(!is(), newCount >= SLOT_CAPACITY_MIN); /* * Slot capacities are determined by the span of allocated objects. Due to @@ -463,20 +461,20 @@ NativeObject::growSlots(ExclusiveContext *cx, HandleNativeObject obj, uint32_t o MOZ_ASSERT(newCount < NELEMENTS_LIMIT); if (!oldCount) { - obj->slots_ = AllocateSlots(cx, obj, newCount); - if (!obj->slots_) + slots_ = AllocateSlots(cx, this, newCount); + if (!slots_) return false; - Debug_SetSlotRangeToCrashOnTouch(obj->slots_, newCount); + Debug_SetSlotRangeToCrashOnTouch(slots_, newCount); return true; } - HeapSlot *newslots = ReallocateSlots(cx, obj, obj->slots_, oldCount, newCount); + HeapSlot *newslots = ReallocateSlots(cx, this, slots_, oldCount, newCount); if (!newslots) return false; /* Leave slots at its old size. */ - obj->slots_ = newslots; + slots_ = newslots; - Debug_SetSlotRangeToCrashOnTouch(obj->slots_ + oldCount, newCount - oldCount); + Debug_SetSlotRangeToCrashOnTouch(slots_ + oldCount, newCount - oldCount); return true; } @@ -490,25 +488,24 @@ FreeSlots(ExclusiveContext *cx, HeapSlot *slots) js_free(slots); } -/* static */ void -NativeObject::shrinkSlots(ExclusiveContext *cx, HandleNativeObject obj, - uint32_t oldCount, uint32_t newCount) +void +NativeObject::shrinkSlots(ExclusiveContext *cx, uint32_t oldCount, uint32_t newCount) { MOZ_ASSERT(newCount < oldCount); if (newCount == 0) { - FreeSlots(cx, obj->slots_); - obj->slots_ = nullptr; + FreeSlots(cx, slots_); + slots_ = nullptr; return; } - MOZ_ASSERT_IF(!obj->is(), newCount >= SLOT_CAPACITY_MIN); + MOZ_ASSERT_IF(!is(), newCount >= SLOT_CAPACITY_MIN); - HeapSlot *newslots = ReallocateSlots(cx, obj, obj->slots_, oldCount, newCount); + HeapSlot *newslots = ReallocateSlots(cx, this, slots_, oldCount, newCount); if (!newslots) return; /* Leave slots at its old size. */ - obj->slots_ = newslots; + slots_ = newslots; } /* static */ bool @@ -988,7 +985,7 @@ NativeObject::allocSlot(ExclusiveContext *cx, HandleNativeObject obj, uint32_t * *slotp = slot; - if (obj->inDictionaryMode() && !setSlotSpan(cx, obj, slot + 1)) + if (obj->inDictionaryMode() && !obj->setSlotSpan(cx, slot + 1)) return false; return true; diff --git a/js/src/vm/NativeObject.h b/js/src/vm/NativeObject.h index d4701b3fa2c5..d52d9799a533 100644 --- a/js/src/vm/NativeObject.h +++ b/js/src/vm/NativeObject.h @@ -399,12 +399,9 @@ class NativeObject : public JSObject return getElementsHeader()->capacity; } - /* - * Update the last property, keeping the number of allocated slots in sync - * with the object's new slot span. - */ - static bool setLastProperty(ExclusiveContext *cx, - HandleNativeObject obj, HandleShape shape); + // Update the last property, keeping the number of allocated slots in sync + // with the object's new slot span. + bool setLastProperty(ExclusiveContext *cx, Shape *shape); // As for setLastProperty(), but allows the number of fixed slots to // change. This can only be used when fixed slots are being erased from the @@ -420,8 +417,7 @@ class NativeObject : public JSObject // As for setLastProperty(), but changes the class associated with the // object to a native one. The object's type has already been changed, and // this brings the shape into sync with it. - static void setLastPropertyMakeNative(ExclusiveContext *cx, HandleNativeObject obj, - HandleShape shape); + void setLastPropertyMakeNative(ExclusiveContext *cx, Shape *shape); protected: #ifdef DEBUG @@ -447,7 +443,7 @@ class NativeObject : public JSObject * Update the slot span directly for a dictionary object, and allocate * slots to cover the new span if necessary. */ - static bool setSlotSpan(ExclusiveContext *cx, HandleNativeObject obj, uint32_t span); + bool setSlotSpan(ExclusiveContext *cx, uint32_t span); bool toDictionaryMode(ExclusiveContext *cx); @@ -590,10 +586,8 @@ class NativeObject : public JSObject * The number of allocated slots is not stored explicitly, and changes to * the slots must track changes in the slot span. */ - static bool growSlots(ExclusiveContext *cx, HandleNativeObject obj, uint32_t oldCount, - uint32_t newCount); - static void shrinkSlots(ExclusiveContext *cx, HandleNativeObject obj, uint32_t oldCount, - uint32_t newCount); + bool growSlots(ExclusiveContext *cx, uint32_t oldCount, uint32_t newCount); + void shrinkSlots(ExclusiveContext *cx, uint32_t oldCount, uint32_t newCount); bool hasDynamicSlots() const { return !!slots_; } @@ -791,8 +785,7 @@ class NativeObject : public JSObject static const uint32_t MAX_FIXED_SLOTS = 16; protected: - static inline bool updateSlotsForSpan(ExclusiveContext *cx, - HandleNativeObject obj, size_t oldSpan, size_t newSpan); + inline bool updateSlotsForSpan(ExclusiveContext *cx, size_t oldSpan, size_t newSpan); public: /* diff --git a/js/src/vm/ObjectGroup.cpp b/js/src/vm/ObjectGroup.cpp index cf95c4be6678..28a1873c92d6 100644 --- a/js/src/vm/ObjectGroup.cpp +++ b/js/src/vm/ObjectGroup.cpp @@ -334,7 +334,7 @@ JSObject::makeLazyGroup(JSContext *cx, HandleObject obj) JSObject::setNewGroupUnknown(JSContext *cx, const js::Class *clasp, JS::HandleObject obj) { ObjectGroup::setDefaultNewGroupUnknown(cx, clasp, obj); - return obj->setFlag(cx, BaseShape::NEW_GROUP_UNKNOWN); + return obj->setFlags(cx, BaseShape::NEW_GROUP_UNKNOWN); } ///////////////////////////////////////////////////////////////////// @@ -1057,8 +1057,7 @@ ObjectGroup::newPlainObject(JSContext *cx, IdValuePair *properties, size_t nprop } MOZ_ASSERT(obj->getProto() == p->value().group->proto().toObject()); - RootedShape shape(cx, p->value().shape); - if (!NativeObject::setLastProperty(cx, obj, shape)) { + if (!obj->setLastProperty(cx, p->value().shape)) { cx->clearPendingException(); return nullptr; } diff --git a/js/src/vm/Shape.cpp b/js/src/vm/Shape.cpp index 2655b1b36a6e..2740a7a4742d 100644 --- a/js/src/vm/Shape.cpp +++ b/js/src/vm/Shape.cpp @@ -387,7 +387,7 @@ NativeObject::getChildPropertyOnDictionary(ExclusiveContext *cx, HandleNativeObj if (!shape) return nullptr; if (childRoot->hasSlot() && childRoot->slot() >= obj->lastProperty()->base()->slotSpan()) { - if (!setSlotSpan(cx, obj, childRoot->slot() + 1)) + if (!obj->setSlotSpan(cx, childRoot->slot() + 1)) return nullptr; } shape->initDictionaryShape(*childRoot, obj->numFixedSlots(), &obj->shape_); @@ -401,7 +401,7 @@ NativeObject::getChildProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleShape parent, StackShape &unrootedChild) { RootedGeneric child(cx, &unrootedChild); - RootedShape shape(cx, getChildPropertyOnDictionary(cx, obj, parent, *child)); + Shape *shape = getChildPropertyOnDictionary(cx, obj, parent, *child); if (!obj->inDictionaryMode()) { shape = cx->compartment()->propertyTree.getChild(cx, parent, *child); @@ -409,7 +409,7 @@ NativeObject::getChildProperty(ExclusiveContext *cx, return nullptr; //MOZ_ASSERT(shape->parent == parent); //MOZ_ASSERT_IF(parent != lastProperty(), parent == lastProperty()->parent); - if (!setLastProperty(cx, obj, shape)) + if (!obj->setLastProperty(cx, shape)) return nullptr; } @@ -1026,7 +1026,7 @@ NativeObject::removeProperty(ExclusiveContext *cx, jsid id_) /* static */ void NativeObject::clear(JSContext *cx, HandleNativeObject obj) { - RootedShape shape(cx, obj->lastProperty()); + Shape *shape = obj->lastProperty(); MOZ_ASSERT(obj->inDictionaryMode() == shape->inDictionary()); while (shape->parent) { @@ -1038,7 +1038,7 @@ NativeObject::clear(JSContext *cx, HandleNativeObject obj) if (obj->inDictionaryMode()) shape->listp = &obj->shape_; - JS_ALWAYS_TRUE(setLastProperty(cx, obj, shape)); + JS_ALWAYS_TRUE(obj->setLastProperty(cx, shape)); ++cx->runtime()->propertyRemovals; obj->checkShapeConsistency(); @@ -1205,12 +1205,12 @@ Shape::setObjectMetadata(JSContext *cx, JSObject *metadata, TaggedProto proto, S } bool -JSObject::setFlag(ExclusiveContext *cx, /*BaseShape::Flag*/ uint32_t flag_, - GenerateShape generateShape) +JSObject::setFlags(ExclusiveContext *cx, /*BaseShape::Flag*/ uint32_t flags_, + GenerateShape generateShape) { - BaseShape::Flag flag = (BaseShape::Flag) flag_; + BaseShape::Flag flags = (BaseShape::Flag) flags_; - if (lastProperty()->getObjectFlags() & flag) + if ((lastProperty()->getObjectFlags() & flags) == flags) return true; RootedObject self(cx, this); @@ -1219,7 +1219,7 @@ JSObject::setFlag(ExclusiveContext *cx, /*BaseShape::Flag*/ uint32_t flag_, if (generateShape == GENERATE_SHAPE && !as().generateOwnShape(cx)) return false; StackBaseShape base(self->lastProperty()); - base.flags |= flag; + base.flags |= flags; UnownedBaseShape *nbase = BaseShape::getUnowned(cx, base); if (!nbase) return false; @@ -1229,7 +1229,7 @@ JSObject::setFlag(ExclusiveContext *cx, /*BaseShape::Flag*/ uint32_t flag_, } Shape *newShape = - Shape::setObjectFlag(cx, flag, self->getTaggedProto(), self->lastProperty()); + Shape::setObjectFlags(cx, flags, self->getTaggedProto(), self->lastProperty()); if (!newShape) return false; @@ -1256,13 +1256,13 @@ NativeObject::clearFlag(ExclusiveContext *cx, BaseShape::Flag flag) } /* static */ Shape * -Shape::setObjectFlag(ExclusiveContext *cx, BaseShape::Flag flag, TaggedProto proto, Shape *last) +Shape::setObjectFlags(ExclusiveContext *cx, BaseShape::Flag flags, TaggedProto proto, Shape *last) { - if (last->getObjectFlags() & flag) + if ((last->getObjectFlags() & flags) == flags) return last; StackBaseShape base(last); - base.flags |= flag; + base.flags |= flags; RootedShape lastRoot(cx, last); return replaceLastProperty(cx, base, proto, lastRoot); diff --git a/js/src/vm/Shape.h b/js/src/vm/Shape.h index 2d3ca3f7b421..59618860674c 100644 --- a/js/src/vm/Shape.h +++ b/js/src/vm/Shape.h @@ -834,8 +834,8 @@ class Shape : public gc::TenuredCell JSObject *obj, TaggedProto proto, Shape *last); static Shape *setObjectMetadata(JSContext *cx, JSObject *metadata, TaggedProto proto, Shape *last); - static Shape *setObjectFlag(ExclusiveContext *cx, - BaseShape::Flag flag, TaggedProto proto, Shape *last); + static Shape *setObjectFlags(ExclusiveContext *cx, + BaseShape::Flag flag, TaggedProto proto, Shape *last); uint32_t getObjectFlags() const { return base()->getObjectFlags(); } bool hasObjectFlag(BaseShape::Flag flag) const { diff --git a/js/src/vm/UnboxedObject.cpp b/js/src/vm/UnboxedObject.cpp index 53e96650168c..90fa0739918c 100644 --- a/js/src/vm/UnboxedObject.cpp +++ b/js/src/vm/UnboxedObject.cpp @@ -197,7 +197,7 @@ UnboxedPlainObject::convertToNative(JSContext *cx) return false; RootedNativeObject nobj(cx, &obj->as()); - NativeObject::setLastPropertyMakeNative(cx, nobj, shape); + nobj->setLastPropertyMakeNative(cx, shape); for (size_t i = 0; i < values.length(); i++) nobj->initSlotUnchecked(i, values[i]); From 27e451c1bddc72190be7ac8fb2c2e6616e0eb84b Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Wed, 18 Feb 2015 07:19:29 -0800 Subject: [PATCH 058/115] Back out bug 1071880 for causing bug 1083952. --- browser/components/nsBrowserGlue.js | 75 ----------------- .../en-US/chrome/browser/browser.properties | 11 --- modules/libpref/init/all.js | 6 -- toolkit/modules/AddonWatcher.jsm | 83 ------------------- toolkit/modules/moz.build | 1 - 5 files changed, 176 deletions(-) delete mode 100644 toolkit/modules/AddonWatcher.jsm diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index 8bf3ae03fbf5..6eee9caa2a3c 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -145,9 +145,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "WebChannel", XPCOMUtils.defineLazyModuleGetter(this, "ReaderParent", "resource:///modules/ReaderParent.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "AddonWatcher", - "resource://gre/modules/AddonWatcher.jsm"); - const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser"; const PREF_PLUGINS_UPDATEURL = "plugins.update.url"; @@ -574,76 +571,6 @@ BrowserGlue.prototype = { this._distributionCustomizer.applyPrefDefaults(); }, - _notifySlowAddon: function BG_notifySlowAddon(addonId) { - let addonCallback = function(addon) { - if (!addon) { - Cu.reportError("couldn't look up addon: " + addonId); - return; - } - let win = RecentWindow.getMostRecentBrowserWindow(); - - if (!win) { - return; - } - - let brandBundle = win.document.getElementById("bundle_brand"); - let brandShortName = brandBundle.getString("brandShortName"); - let message = win.gNavigatorBundle.getFormattedString("addonwatch.slow", [addon.name, brandShortName]); - let notificationBox = win.document.getElementById("global-notificationbox"); - let notificationId = 'addon-slow:' + addonId; - let notification = notificationBox.getNotificationWithValue(notificationId); - if(notification) { - notification.label = message; - } else { - let buttons = [ - { - label: win.gNavigatorBundle.getFormattedString("addonwatch.disable.label", [addon.name]), - accessKey: win.gNavigatorBundle.getString("addonwatch.disable.accesskey"), - callback: function() { - addon.userDisabled = true; - if (addon.pendingOperations != addon.PENDING_NONE) { - let restartMessage = win.gNavigatorBundle.getFormattedString("addonwatch.restart.message", [addon.name, brandShortName]); - let restartButton = [ - { - label: win.gNavigatorBundle.getFormattedString("addonwatch.restart.label", [brandShortName]), - accessKey: win.gNavigatorBundle.getString("addonwatch.restart.accesskey"), - callback: function() { - let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"] - .getService(Ci.nsIAppStartup); - appStartup.quit(appStartup.eForceQuit | appStartup.eRestart); - } - } - ]; - const priority = notificationBox.PRIORITY_WARNING_MEDIUM; - notificationBox.appendNotification(restartMessage, "restart-" + addonId, "", - priority, restartButton); - } - } - }, - { - label: win.gNavigatorBundle.getString("addonwatch.ignoreSession.label"), - accessKey: win.gNavigatorBundle.getString("addonwatch.ignoreSession.accesskey"), - callback: function() { - AddonWatcher.ignoreAddonForSession(addonId); - } - }, - { - label: win.gNavigatorBundle.getString("addonwatch.ignorePerm.label"), - accessKey: win.gNavigatorBundle.getString("addonwatch.ignorePerm.accesskey"), - callback: function() { - AddonWatcher.ignoreAddonPermanently(addonId); - } - }, - ]; - - const priority = notificationBox.PRIORITY_WARNING_MEDIUM; - notificationBox.appendNotification(message, notificationId, "", - priority, buttons); - } - }; - AddonManager.getAddonByID(addonId, addonCallback); - }, - // runs on startup, before the first command line handler is invoked // (i.e. before the first window is opened) _finalUIStartup: function BG__finalUIStartup() { @@ -697,8 +624,6 @@ BrowserGlue.prototype = { #endif Services.obs.notifyObservers(null, "browser-ui-startup-complete", ""); - - AddonWatcher.init(this._notifySlowAddon); }, _checkForOldBuildUpdates: function () { diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties index 0a117d96ebf7..9ec8b61b1268 100644 --- a/browser/locales/en-US/chrome/browser/browser.properties +++ b/browser/locales/en-US/chrome/browser/browser.properties @@ -40,17 +40,6 @@ addonDownloadRestart=Restart Download;Restart Downloads addonDownloadRestart.accessKey=R addonDownloadCancelTooltip=Cancel -addonwatch.slow=%S might be making %S run slowly -addonwatch.disable.label=Disable %S -addonwatch.disable.accesskey=D -addonwatch.ignoreSession.label=Ignore for now -addonwatch.ignoreSession.accesskey=I -addonwatch.ignorePerm.label=Ignore permanently -addonwatch.ignorePerm.accesskey=p -addonwatch.restart.message=To disable %S you must restart %S -addonwatch.restart.label=Restart %s -addonwatch.restart.accesskey=R - # LOCALIZATION NOTE (addonsInstalled, addonsInstalledNeedsRestart): # Semicolon-separated list of plural forms. See: # http://developer.mozilla.org/en/docs/Localization_and_Plurals diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index a041c0f5919c..36c30e1aa9b3 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4471,12 +4471,6 @@ pref("dom.mozSettings.SettingsService.verbose.enabled", false); // readwrite. pref("dom.mozSettings.allowForceReadOnly", false); -// The interval at which to check for slow running addons -pref("browser.addon-watch.interval", 120000); -pref("browser.addon-watch.ignore", "[\"mochikit@mozilla.org\",\"special-powers@mozilla.org\"]"); -// the percentage of time addons are allowed to use without being labeled slow -pref("browser.addon-watch.percentage-limit", 1); - // RequestSync API is disabled by default. pref("dom.requestSync.enabled", false); diff --git a/toolkit/modules/AddonWatcher.jsm b/toolkit/modules/AddonWatcher.jsm deleted file mode 100644 index 29877ef9595e..000000000000 --- a/toolkit/modules/AddonWatcher.jsm +++ /dev/null @@ -1,83 +0,0 @@ -// -*- indent-tabs-mode: nil; js-indent-level: 2 -*- -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -this.EXPORTED_SYMBOLS = ["AddonWatcher"]; - -const { classes: Cc, interfaces: Ci, utils: Cu } = Components; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); - -XPCOMUtils.defineLazyModuleGetter(this, "Preferences", - "resource://gre/modules/Preferences.jsm"); - -let AddonWatcher = { - _lastAddonTime: {}, - _timer: Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer), - _callback: null, - _interval: 1500, - _ignoreList: null, - init: function(callback) { - if (!callback) { - return; - } - - if (this._callback) { - return; - } - - this._callback = callback; - try { - this._ignoreList = new Set(JSON.parse(Preferences.get("browser.addon-watch.ignore", null))); - } catch (ex) { - // probably some malformed JSON, ignore and carry on - this._ignoreList = new Set(); - } - this._interval = Preferences.get("browser.addon-watch.interval", 15000); - this._timer.initWithCallback(this._checkAddons.bind(this), this._interval, Ci.nsITimer.TYPE_REPEATING_SLACK); - }, - _checkAddons: function() { - let compartmentInfo = Cc["@mozilla.org/compartment-info;1"] - .getService(Ci.nsICompartmentInfo); - let compartments = compartmentInfo.getCompartments(); - let count = compartments.length; - let addons = {}; - for (let i = 0; i < count; i++) { - let compartment = compartments.queryElementAt(i, Ci.nsICompartment); - if (compartment.addonId) { - if (addons[compartment.addonId]) { - addons[compartment.addonId] += compartment.time; - } else { - addons[compartment.addonId] = compartment.time; - } - } - } - let limit = this._interval * Preferences.get("browser.addon-watch.percentage-limit", 75) * 10; - for (let addonId in addons) { - if (!this._ignoreList.has(addonId)) { - if (this._lastAddonTime[addonId] && (addons[addonId] - this._lastAddonTime[addonId]) > limit) { - this._callback(addonId); - } - this._lastAddonTime[addonId] = addons[addonId]; - } - } - }, - ignoreAddonForSession: function(addonid) { - this._ignoreList.add(addonid); - }, - ignoreAddonPermanently: function(addonid) { - this._ignoreList.add(addonid); - try { - let ignoreList = JSON.parse(Preferences.get("browser.addon-watch.ignore", "[]")) - if (!ignoreList.includes(addonid)) { - ignoreList.push(addonid); - Preferences.set("browser.addon-watch.ignore", JSON.stringify(ignoreList)); - } - } catch (ex) { - Preferences.set("browser.addon-watch.ignore", JSON.stringify([addonid])); - } - } -}; diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build index b61858006221..584778a7ccb2 100644 --- a/toolkit/modules/moz.build +++ b/toolkit/modules/moz.build @@ -12,7 +12,6 @@ MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini'] SPHINX_TREES['toolkit_modules'] = 'docs' EXTRA_JS_MODULES += [ - 'AddonWatcher.jsm', 'Battery.jsm', 'BinarySearch.jsm', 'BrowserUtils.jsm', From ad762b9022e9643daf9a893e0e8e2d7763e916ca Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Tue, 17 Feb 2015 19:53:06 -0800 Subject: [PATCH 059/115] Bug 1109910 - Move LoadInfo from docShell into Necko (r=sicking,sworkman) --HG-- rename : docshell/base/LoadInfo.cpp => netwerk/base/LoadInfo.cpp rename : docshell/base/LoadInfo.h => netwerk/base/LoadInfo.h rename : docshell/base/nsILoadInfo.idl => netwerk/base/nsILoadInfo.idl --- docshell/base/moz.build | 3 --- {docshell => netwerk}/base/LoadInfo.cpp | 0 {docshell => netwerk}/base/LoadInfo.h | 0 netwerk/base/moz.build | 6 ++++++ {docshell => netwerk}/base/nsILoadInfo.idl | 0 5 files changed, 6 insertions(+), 3 deletions(-) rename {docshell => netwerk}/base/LoadInfo.cpp (100%) rename {docshell => netwerk}/base/LoadInfo.h (100%) rename {docshell => netwerk}/base/nsILoadInfo.idl (100%) diff --git a/docshell/base/moz.build b/docshell/base/moz.build index b99821324228..4da08ab4d1da 100644 --- a/docshell/base/moz.build +++ b/docshell/base/moz.build @@ -20,7 +20,6 @@ XPIDL_SOURCES += [ 'nsIDownloadHistory.idl', 'nsIGlobalHistory2.idl', 'nsILoadContext.idl', - 'nsILoadInfo.idl', 'nsIPrivacyTransitionObserver.idl', 'nsIReflowObserver.idl', 'nsIRefreshURI.idl', @@ -45,12 +44,10 @@ EXPORTS += [ EXPORTS.mozilla += [ 'IHistory.h', 'LoadContext.h', - 'LoadInfo.h', ] UNIFIED_SOURCES += [ 'LoadContext.cpp', - 'LoadInfo.cpp', 'nsAboutRedirector.cpp', 'nsDefaultURIFixup.cpp', 'nsDocShell.cpp', diff --git a/docshell/base/LoadInfo.cpp b/netwerk/base/LoadInfo.cpp similarity index 100% rename from docshell/base/LoadInfo.cpp rename to netwerk/base/LoadInfo.cpp diff --git a/docshell/base/LoadInfo.h b/netwerk/base/LoadInfo.h similarity index 100% rename from docshell/base/LoadInfo.h rename to netwerk/base/LoadInfo.h diff --git a/netwerk/base/moz.build b/netwerk/base/moz.build index 7075d5ad162a..877365bba5d2 100644 --- a/netwerk/base/moz.build +++ b/netwerk/base/moz.build @@ -53,6 +53,7 @@ XPIDL_SOURCES += [ 'nsILoadContextInfo.idl', 'nsILoadGroup.idl', 'nsILoadGroupChild.idl', + 'nsILoadInfo.idl', 'nsIMIMEInputStream.idl', 'nsIMultiPartChannel.idl', 'nsINestedURI.idl', @@ -152,6 +153,10 @@ EXPORTS += [ 'nsURLParsers.h', ] +EXPORTS.mozilla += [ + 'LoadInfo.h', +] + EXPORTS.mozilla.net += [ 'ChannelDiverterChild.h', 'ChannelDiverterParent.h', @@ -174,6 +179,7 @@ UNIFIED_SOURCES += [ 'Dashboard.cpp', 'EventTokenBucket.cpp', 'LoadContextInfo.cpp', + 'LoadInfo.cpp', 'NetworkActivityMonitor.cpp', 'nsAsyncRedirectVerifyHelper.cpp', 'nsAsyncStreamCopier.cpp', diff --git a/docshell/base/nsILoadInfo.idl b/netwerk/base/nsILoadInfo.idl similarity index 100% rename from docshell/base/nsILoadInfo.idl rename to netwerk/base/nsILoadInfo.idl From c644d095b35abefb6a72e37ca5aa8993b1836282 Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Tue, 17 Feb 2015 19:53:36 -0800 Subject: [PATCH 060/115] Bug 1124950: Make JS callers of ios.newChannel call ios.newChannel2 in toolkit/webapps (r=marco) --- toolkit/webapps/NativeApp.jsm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/toolkit/webapps/NativeApp.jsm b/toolkit/webapps/NativeApp.jsm index 5aa9b6e017a1..515b1bd0c895 100644 --- a/toolkit/webapps/NativeApp.jsm +++ b/toolkit/webapps/NativeApp.jsm @@ -446,7 +446,24 @@ function downloadIcon(aIconURI) { }); #endif - let channel = NetUtil.newChannel(aIconURI); + // If not fetching an icon from chrome:// then we should create a + // NoAppCodeBasePrincipal. Note, that we are still in the process of + // installing the app, hence app.origin is not available yet and + // therefore we can not call getAppCodebasePrincipal. + let principal = + aIconURI.schemeIs("chrome") ? Services.scriptSecurityManager + .getSystemPrincipal() + : Services.scriptSecurityManager + .getNoAppCodebasePrincipal(aIconURI); + + let channel = NetUtil.newChannel2(aIconURI, + null, + null, + null, // aLoadingNode + principal, + null, // aTriggeringPrincipal + Ci.nsILoadInfo.SEC_NORMAL, + Ci.nsIContentPolicy.TYPE_IMAGE); let { BadCertHandler } = Cu.import("resource://gre/modules/CertUtils.jsm", {}); // Pass true to avoid optional redirect-cert-checking behavior. channel.notificationCallbacks = new BadCertHandler(true); From a6887de13f7a0601aac7b38558868332d1895e00 Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Tue, 17 Feb 2015 19:54:12 -0800 Subject: [PATCH 061/115] Bug 1131455 - about:sync-log assertion failure: newly created channel must have a loadinfo attached (r=rnewman) --- services/sync/Weave.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/services/sync/Weave.js b/services/sync/Weave.js index 0116e70c743f..5c90d8a408ce 100644 --- a/services/sync/Weave.js +++ b/services/sync/Weave.js @@ -177,15 +177,11 @@ AboutWeaveLog.prototype = { return 0; }, - newChannel: function(aURI) { + newChannel: function(aURI, aLoadInfo) { let dir = FileUtils.getDir("ProfD", ["weave", "logs"], true); let uri = Services.io.newFileURI(dir); - let channel = Services.io.newChannelFromURI2(uri, - null, // aLoadingNode - Services.scriptSecurityManager.getSystemPrincipal(), - null, // aTriggeringPrincipal - Ci.nsILoadInfo.SEC_NORMAL, - Ci.nsIContentPolicy.TYPE_OTHER); + let channel = Services.io.newChannelFromURIWithLoadInfo(uri, aLoadInfo); + channel.originalURI = aURI; // Ensure that the about page has the same privileges as a regular directory From 9bdc672f504d36be23e76e1cd86466c7348cbc7e Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Tue, 17 Feb 2015 19:53:53 -0800 Subject: [PATCH 062/115] Bug 1116278 - Follow up: Using new channel API in browser/components/feeds (r=sicking) --- browser/components/feeds/FeedConverter.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/browser/components/feeds/FeedConverter.js b/browser/components/feeds/FeedConverter.js index e7c2d8439d92..75115cc94d1a 100644 --- a/browser/components/feeds/FeedConverter.js +++ b/browser/components/feeds/FeedConverter.js @@ -548,15 +548,12 @@ GenericProtocolHandler.prototype = { return uri; }, - newChannel: function GPH_newChannel(aUri) { + newChannel2: function GPH_newChannel(aUri, aLoadInfo) { var inner = aUri.QueryInterface(Ci.nsINestedURI).innerURI; var channel = Cc["@mozilla.org/network/io-service;1"]. - getService(Ci.nsIIOService).newChannelFromURI2(inner, - null, // aLoadingNode - Services.scriptSecurityManager.getSystemPrincipal(), - null, // aTriggeringPrincipal - Ci.nsILoadInfo.SEC_NORMAL, - Ci.nsIContentPolicy.TYPE_OTHER); + getService(Ci.nsIIOService). + newChannelFromURIWithLoadInfo(inner, aLoadInfo); + if (channel instanceof Components.interfaces.nsIHttpChannel) // Set this so we know this is supposed to be a feed channel.setRequestHeader("X-Moz-Is-Feed", "1", false); @@ -564,6 +561,7 @@ GenericProtocolHandler.prototype = { return channel; }, + QueryInterface: function GPH_QueryInterface(iid) { if (iid.equals(Ci.nsIProtocolHandler) || iid.equals(Ci.nsISupports)) From 9b757a1eeb536a3ce37d50f8640b0d63c991e078 Mon Sep 17 00:00:00 2001 From: Armen Zambrano Gasparnian Date: Wed, 18 Feb 2015 11:04:52 -0500 Subject: [PATCH 063/115] Bug 1110286 - Pin mozharness to 2264bffd89ca instead of production. r=rail --- testing/mozharness/mozharness.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/mozharness/mozharness.json b/testing/mozharness/mozharness.json index 88b1887c440e..a89d26c310e0 100644 --- a/testing/mozharness/mozharness.json +++ b/testing/mozharness/mozharness.json @@ -1,4 +1,4 @@ { "repo": "https://hg.mozilla.org/build/mozharness", - "revision": "production" + "revision": "2264bffd89ca" } From cd9b02cc356f9bca0124bd4af3df94fc4676c8d9 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Wed, 18 Feb 2015 17:15:00 +0100 Subject: [PATCH 064/115] Backed out changeset 5f5540f3fcce (bug 1109910) for Bustage on a CLOSED TREE --HG-- rename : netwerk/base/LoadInfo.cpp => docshell/base/LoadInfo.cpp rename : netwerk/base/LoadInfo.h => docshell/base/LoadInfo.h rename : netwerk/base/nsILoadInfo.idl => docshell/base/nsILoadInfo.idl --- {netwerk => docshell}/base/LoadInfo.cpp | 0 {netwerk => docshell}/base/LoadInfo.h | 0 docshell/base/moz.build | 3 +++ {netwerk => docshell}/base/nsILoadInfo.idl | 0 netwerk/base/moz.build | 6 ------ 5 files changed, 3 insertions(+), 6 deletions(-) rename {netwerk => docshell}/base/LoadInfo.cpp (100%) rename {netwerk => docshell}/base/LoadInfo.h (100%) rename {netwerk => docshell}/base/nsILoadInfo.idl (100%) diff --git a/netwerk/base/LoadInfo.cpp b/docshell/base/LoadInfo.cpp similarity index 100% rename from netwerk/base/LoadInfo.cpp rename to docshell/base/LoadInfo.cpp diff --git a/netwerk/base/LoadInfo.h b/docshell/base/LoadInfo.h similarity index 100% rename from netwerk/base/LoadInfo.h rename to docshell/base/LoadInfo.h diff --git a/docshell/base/moz.build b/docshell/base/moz.build index 4da08ab4d1da..b99821324228 100644 --- a/docshell/base/moz.build +++ b/docshell/base/moz.build @@ -20,6 +20,7 @@ XPIDL_SOURCES += [ 'nsIDownloadHistory.idl', 'nsIGlobalHistory2.idl', 'nsILoadContext.idl', + 'nsILoadInfo.idl', 'nsIPrivacyTransitionObserver.idl', 'nsIReflowObserver.idl', 'nsIRefreshURI.idl', @@ -44,10 +45,12 @@ EXPORTS += [ EXPORTS.mozilla += [ 'IHistory.h', 'LoadContext.h', + 'LoadInfo.h', ] UNIFIED_SOURCES += [ 'LoadContext.cpp', + 'LoadInfo.cpp', 'nsAboutRedirector.cpp', 'nsDefaultURIFixup.cpp', 'nsDocShell.cpp', diff --git a/netwerk/base/nsILoadInfo.idl b/docshell/base/nsILoadInfo.idl similarity index 100% rename from netwerk/base/nsILoadInfo.idl rename to docshell/base/nsILoadInfo.idl diff --git a/netwerk/base/moz.build b/netwerk/base/moz.build index 877365bba5d2..7075d5ad162a 100644 --- a/netwerk/base/moz.build +++ b/netwerk/base/moz.build @@ -53,7 +53,6 @@ XPIDL_SOURCES += [ 'nsILoadContextInfo.idl', 'nsILoadGroup.idl', 'nsILoadGroupChild.idl', - 'nsILoadInfo.idl', 'nsIMIMEInputStream.idl', 'nsIMultiPartChannel.idl', 'nsINestedURI.idl', @@ -153,10 +152,6 @@ EXPORTS += [ 'nsURLParsers.h', ] -EXPORTS.mozilla += [ - 'LoadInfo.h', -] - EXPORTS.mozilla.net += [ 'ChannelDiverterChild.h', 'ChannelDiverterParent.h', @@ -179,7 +174,6 @@ UNIFIED_SOURCES += [ 'Dashboard.cpp', 'EventTokenBucket.cpp', 'LoadContextInfo.cpp', - 'LoadInfo.cpp', 'NetworkActivityMonitor.cpp', 'nsAsyncRedirectVerifyHelper.cpp', 'nsAsyncStreamCopier.cpp', From 1c3057e19317152ca080031133bb48db2f19de6c Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Tue, 17 Feb 2015 19:53:06 -0800 Subject: [PATCH 065/115] CLOSED TREE - Bug 1109910 - Move LoadInfo from docShell into Necko (r=sicking,sworkman) --HG-- rename : docshell/base/LoadInfo.cpp => netwerk/base/LoadInfo.cpp rename : docshell/base/LoadInfo.h => netwerk/base/LoadInfo.h rename : docshell/base/nsILoadInfo.idl => netwerk/base/nsILoadInfo.idl --- CLOBBER | 2 +- docshell/base/moz.build | 3 --- {docshell => netwerk}/base/LoadInfo.cpp | 0 {docshell => netwerk}/base/LoadInfo.h | 0 netwerk/base/moz.build | 6 ++++++ {docshell => netwerk}/base/nsILoadInfo.idl | 0 6 files changed, 7 insertions(+), 4 deletions(-) rename {docshell => netwerk}/base/LoadInfo.cpp (100%) rename {docshell => netwerk}/base/LoadInfo.h (100%) rename {docshell => netwerk}/base/nsILoadInfo.idl (100%) diff --git a/CLOBBER b/CLOBBER index 2cb15c63b78c..10912d78ab19 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,4 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Bug 879861 - Touch CLOBBER because adding a new IDL is a crapshoot these days. +Bug 1109910 - Touch CLOBBER because moving an IDL caused build bustage diff --git a/docshell/base/moz.build b/docshell/base/moz.build index b99821324228..4da08ab4d1da 100644 --- a/docshell/base/moz.build +++ b/docshell/base/moz.build @@ -20,7 +20,6 @@ XPIDL_SOURCES += [ 'nsIDownloadHistory.idl', 'nsIGlobalHistory2.idl', 'nsILoadContext.idl', - 'nsILoadInfo.idl', 'nsIPrivacyTransitionObserver.idl', 'nsIReflowObserver.idl', 'nsIRefreshURI.idl', @@ -45,12 +44,10 @@ EXPORTS += [ EXPORTS.mozilla += [ 'IHistory.h', 'LoadContext.h', - 'LoadInfo.h', ] UNIFIED_SOURCES += [ 'LoadContext.cpp', - 'LoadInfo.cpp', 'nsAboutRedirector.cpp', 'nsDefaultURIFixup.cpp', 'nsDocShell.cpp', diff --git a/docshell/base/LoadInfo.cpp b/netwerk/base/LoadInfo.cpp similarity index 100% rename from docshell/base/LoadInfo.cpp rename to netwerk/base/LoadInfo.cpp diff --git a/docshell/base/LoadInfo.h b/netwerk/base/LoadInfo.h similarity index 100% rename from docshell/base/LoadInfo.h rename to netwerk/base/LoadInfo.h diff --git a/netwerk/base/moz.build b/netwerk/base/moz.build index 7075d5ad162a..877365bba5d2 100644 --- a/netwerk/base/moz.build +++ b/netwerk/base/moz.build @@ -53,6 +53,7 @@ XPIDL_SOURCES += [ 'nsILoadContextInfo.idl', 'nsILoadGroup.idl', 'nsILoadGroupChild.idl', + 'nsILoadInfo.idl', 'nsIMIMEInputStream.idl', 'nsIMultiPartChannel.idl', 'nsINestedURI.idl', @@ -152,6 +153,10 @@ EXPORTS += [ 'nsURLParsers.h', ] +EXPORTS.mozilla += [ + 'LoadInfo.h', +] + EXPORTS.mozilla.net += [ 'ChannelDiverterChild.h', 'ChannelDiverterParent.h', @@ -174,6 +179,7 @@ UNIFIED_SOURCES += [ 'Dashboard.cpp', 'EventTokenBucket.cpp', 'LoadContextInfo.cpp', + 'LoadInfo.cpp', 'NetworkActivityMonitor.cpp', 'nsAsyncRedirectVerifyHelper.cpp', 'nsAsyncStreamCopier.cpp', diff --git a/docshell/base/nsILoadInfo.idl b/netwerk/base/nsILoadInfo.idl similarity index 100% rename from docshell/base/nsILoadInfo.idl rename to netwerk/base/nsILoadInfo.idl From 126294da7da8132c4a9f5b47a7ddab1148fdcaa1 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 18 Feb 2015 11:57:57 -0500 Subject: [PATCH 066/115] Backed out changeset 73e586b9f04f (bug 1109910) for bustage. CLOSED TREE --HG-- rename : netwerk/base/LoadInfo.cpp => docshell/base/LoadInfo.cpp rename : netwerk/base/LoadInfo.h => docshell/base/LoadInfo.h rename : netwerk/base/nsILoadInfo.idl => docshell/base/nsILoadInfo.idl --- CLOBBER | 2 +- {netwerk => docshell}/base/LoadInfo.cpp | 0 {netwerk => docshell}/base/LoadInfo.h | 0 docshell/base/moz.build | 3 +++ {netwerk => docshell}/base/nsILoadInfo.idl | 0 netwerk/base/moz.build | 6 ------ 6 files changed, 4 insertions(+), 7 deletions(-) rename {netwerk => docshell}/base/LoadInfo.cpp (100%) rename {netwerk => docshell}/base/LoadInfo.h (100%) rename {netwerk => docshell}/base/nsILoadInfo.idl (100%) diff --git a/CLOBBER b/CLOBBER index 10912d78ab19..2cb15c63b78c 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,4 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Bug 1109910 - Touch CLOBBER because moving an IDL caused build bustage +Bug 879861 - Touch CLOBBER because adding a new IDL is a crapshoot these days. diff --git a/netwerk/base/LoadInfo.cpp b/docshell/base/LoadInfo.cpp similarity index 100% rename from netwerk/base/LoadInfo.cpp rename to docshell/base/LoadInfo.cpp diff --git a/netwerk/base/LoadInfo.h b/docshell/base/LoadInfo.h similarity index 100% rename from netwerk/base/LoadInfo.h rename to docshell/base/LoadInfo.h diff --git a/docshell/base/moz.build b/docshell/base/moz.build index 4da08ab4d1da..b99821324228 100644 --- a/docshell/base/moz.build +++ b/docshell/base/moz.build @@ -20,6 +20,7 @@ XPIDL_SOURCES += [ 'nsIDownloadHistory.idl', 'nsIGlobalHistory2.idl', 'nsILoadContext.idl', + 'nsILoadInfo.idl', 'nsIPrivacyTransitionObserver.idl', 'nsIReflowObserver.idl', 'nsIRefreshURI.idl', @@ -44,10 +45,12 @@ EXPORTS += [ EXPORTS.mozilla += [ 'IHistory.h', 'LoadContext.h', + 'LoadInfo.h', ] UNIFIED_SOURCES += [ 'LoadContext.cpp', + 'LoadInfo.cpp', 'nsAboutRedirector.cpp', 'nsDefaultURIFixup.cpp', 'nsDocShell.cpp', diff --git a/netwerk/base/nsILoadInfo.idl b/docshell/base/nsILoadInfo.idl similarity index 100% rename from netwerk/base/nsILoadInfo.idl rename to docshell/base/nsILoadInfo.idl diff --git a/netwerk/base/moz.build b/netwerk/base/moz.build index 877365bba5d2..7075d5ad162a 100644 --- a/netwerk/base/moz.build +++ b/netwerk/base/moz.build @@ -53,7 +53,6 @@ XPIDL_SOURCES += [ 'nsILoadContextInfo.idl', 'nsILoadGroup.idl', 'nsILoadGroupChild.idl', - 'nsILoadInfo.idl', 'nsIMIMEInputStream.idl', 'nsIMultiPartChannel.idl', 'nsINestedURI.idl', @@ -153,10 +152,6 @@ EXPORTS += [ 'nsURLParsers.h', ] -EXPORTS.mozilla += [ - 'LoadInfo.h', -] - EXPORTS.mozilla.net += [ 'ChannelDiverterChild.h', 'ChannelDiverterParent.h', @@ -179,7 +174,6 @@ UNIFIED_SOURCES += [ 'Dashboard.cpp', 'EventTokenBucket.cpp', 'LoadContextInfo.cpp', - 'LoadInfo.cpp', 'NetworkActivityMonitor.cpp', 'nsAsyncRedirectVerifyHelper.cpp', 'nsAsyncStreamCopier.cpp', From 804f23b3e0bf965fa7cf7bf8709fa463ff7ddc35 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 18 Feb 2015 12:38:19 -0500 Subject: [PATCH 067/115] Backed out changeset 4ef497dc6f9b (bug 1131557) for frequent Linux xpcshell failures. CLOSED TREE --- modules/libpref/init/all.js | 6 --- netwerk/base/nsSocketTransportService2.cpp | 61 ++-------------------- netwerk/base/nsSocketTransportService2.h | 7 --- 3 files changed, 5 insertions(+), 69 deletions(-) diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 36c30e1aa9b3..62cff348991d 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1359,12 +1359,6 @@ pref("network.http.enforce-framing.http1", false); pref("network.ftp.data.qos", 0); pref("network.ftp.control.qos", 0); -// If this pref is false only one xpcom event will be served per poll -// iteration. This is the original behavior. -// If it is true multiple events will be served. -pref("network.sts.serve_multiple_events_per_poll_iteration", true); -// The max time to spend on xpcom events between two polls in ms. -pref("network.sts.max_time_for_events_between_two_polls", 100); // // 2147483647 == PR_INT32_MAX == ~2 GB diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp index cad179476578..2bdc7b8e55b3 100644 --- a/netwerk/base/nsSocketTransportService2.cpp +++ b/netwerk/base/nsSocketTransportService2.cpp @@ -40,8 +40,6 @@ PRThread *gSocketThread = nullptr; #define SOCKET_LIMIT_TARGET 550U #define SOCKET_LIMIT_MIN 50U #define BLIP_INTERVAL_PREF "network.activity.blipIntervalMilliseconds" -#define SERVE_MULTIPLE_EVENTS_PREF "network.sts.serve_multiple_events_per_poll_iteration" -#define MAX_TIME_BETWEEN_TWO_POLLS "network.sts.max_time_for_events_between_two_polls" uint32_t nsSocketTransportService::gMaxCount; PRCallOnceType nsSocketTransportService::gMaxCountInitOnce; @@ -69,9 +67,6 @@ nsSocketTransportService::nsSocketTransportService() , mKeepaliveRetryIntervalS(1) , mKeepaliveProbeCount(kDefaultTCPKeepCount) , mKeepaliveEnabledPref(false) - , mServeMultipleEventsPerPollIter(true) - , mServingPendingQueue(false) - , mMaxTimePerPollIter(100) , mProbedMaxCount(false) { #if defined(PR_LOGGING) @@ -486,8 +481,6 @@ nsSocketTransportService::Init() tmpPrefService->AddObserver(KEEPALIVE_IDLE_TIME_PREF, this, false); tmpPrefService->AddObserver(KEEPALIVE_RETRY_INTERVAL_PREF, this, false); tmpPrefService->AddObserver(KEEPALIVE_PROBE_COUNT_PREF, this, false); - tmpPrefService->AddObserver(SERVE_MULTIPLE_EVENTS_PREF, this, false); - tmpPrefService->AddObserver(MAX_TIME_BETWEEN_TWO_POLLS, this, false); } UpdatePrefs(); @@ -693,12 +686,6 @@ nsSocketTransportService::AfterProcessNextEvent(nsIThreadInternal* thread, return NS_OK; } -void -nsSocketTransportService::MarkTheLastElementOfPendingQueue() -{ - mServingPendingQueue = false; -} - #ifdef MOZ_NUWA_PROCESS #include "ipc/Nuwa.h" #endif @@ -743,39 +730,15 @@ nsSocketTransportService::Run() // If there are pending events for this thread then // DoPollIteration() should service the network without blocking. DoPollIteration(!pendingEvents); - + // If nothing was pending before the poll, it might be now - if (!pendingEvents) { + if (!pendingEvents) thread->HasPendingEvents(&pendingEvents); - } if (pendingEvents) { - if (mServeMultipleEventsPerPollIter) { - if (!mServingPendingQueue) { - nsresult rv = Dispatch(NS_NewRunnableMethod(this, - &nsSocketTransportService::MarkTheLastElementOfPendingQueue), - nsIEventTarget::DISPATCH_NORMAL); - if (NS_FAILED(rv)) { - NS_WARNING("Could not dispatch a new event on the " - "socket thread."); - } else { - mServingPendingQueue = true; - } - } - TimeStamp eventQueueStart = TimeStamp::NowLoRes(); - do { - NS_ProcessNextEvent(thread); - pendingEvents = false; - thread->HasPendingEvents(&pendingEvents); - } while (pendingEvents && mServingPendingQueue && - ((TimeStamp::NowLoRes() - - eventQueueStart).ToMilliseconds() < - mMaxTimePerPollIter)); - } else { - NS_ProcessNextEvent(thread); - pendingEvents = false; - thread->HasPendingEvents(&pendingEvents); - } + NS_ProcessNextEvent(thread); + pendingEvents = false; + thread->HasPendingEvents(&pendingEvents); } } while (pendingEvents); @@ -1019,20 +982,6 @@ nsSocketTransportService::UpdatePrefs() mKeepaliveEnabledPref = keepaliveEnabled; OnKeepaliveEnabledPrefChange(); } - - bool serveMultiplePref = false; - rv = tmpPrefService->GetBoolPref(SERVE_MULTIPLE_EVENTS_PREF, - &serveMultiplePref); - if (NS_SUCCEEDED(rv)) { - mServeMultipleEventsPerPollIter = serveMultiplePref; - } - - int32_t maxTimePref; - rv = tmpPrefService->GetIntPref(MAX_TIME_BETWEEN_TWO_POLLS, - &maxTimePref); - if (NS_SUCCEEDED(rv) && maxTimePref >= 0) { - mMaxTimePerPollIter = maxTimePref; - } } return NS_OK; diff --git a/netwerk/base/nsSocketTransportService2.h b/netwerk/base/nsSocketTransportService2.h index 9e3fff893968..9bc550fe7d11 100644 --- a/netwerk/base/nsSocketTransportService2.h +++ b/netwerk/base/nsSocketTransportService2.h @@ -17,7 +17,6 @@ #include "nsIObserver.h" #include "mozilla/Mutex.h" #include "mozilla/net/DashboardTypes.h" -#include "mozilla/Atomics.h" class nsASocketHandler; struct PRPollDesc; @@ -218,10 +217,6 @@ private: // True if TCP keepalive is enabled globally. bool mKeepaliveEnabledPref; - bool mServeMultipleEventsPerPollIter; - mozilla::Atomic mServingPendingQueue; - int32_t mMaxTimePerPollIter; - void OnKeepaliveEnabledPrefChange(); void NotifyKeepaliveEnabledPrefChange(SocketContext *sock); @@ -238,8 +233,6 @@ private: void DetachSocketWithGuard(bool aGuardLocals, SocketContext *socketList, int32_t index); - - void MarkTheLastElementOfPendingQueue(); }; extern nsSocketTransportService *gSocketTransportService; From dbf4bef164a9fb6c774d0481321d5a100bb5a7a0 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Wed, 18 Feb 2015 19:06:07 +0100 Subject: [PATCH 068/115] Bug 1134142 - Replace Baseline ICStub New functions with a variadic template function. r=djvj --- js/src/jit/BaselineIC.cpp | 107 ++-- js/src/jit/BaselineIC.h | 1092 +++++-------------------------------- 2 files changed, 191 insertions(+), 1008 deletions(-) diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index 332f8eae87e1..350984395e07 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -7109,23 +7109,23 @@ ICGetPropNativeCompiler::getStub(ICStubSpace *space) case ICStub::GetProp_Native: { MOZ_ASSERT(obj_ == holder_); RootedShape shape(cx, obj_->lastProperty()); - return ICGetProp_Native::New(space, getStubCode(), firstMonitorStub_, shape, offset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, shape, offset_); } case ICStub::GetProp_NativePrototype: { MOZ_ASSERT(obj_ != holder_); RootedShape shape(cx, obj_->lastProperty()); RootedShape holderShape(cx, holder_->lastProperty()); - return ICGetProp_NativePrototype::New(space, getStubCode(), firstMonitorStub_, shape, - offset_, holder_, holderShape); + return ICStub::New(space, getStubCode(), firstMonitorStub_, shape, + offset_, holder_, holderShape); } case ICStub::GetProp_UnboxedPrototype: { MOZ_ASSERT(obj_ != holder_); RootedObjectGroup group(cx, obj_->group()); RootedShape holderShape(cx, holder_->lastProperty()); - return ICGetProp_UnboxedPrototype::New(space, getStubCode(), firstMonitorStub_, group, - offset_, holder_, holderShape); + return ICStub::New(space, getStubCode(), firstMonitorStub_, group, + offset_, holder_, holderShape); } default: @@ -7659,12 +7659,12 @@ ICGetPropCallDOMProxyNativeCompiler::getStub(ICStubSpace *space) expandoShape = expandoVal.toObject().lastProperty(); if (kind == ICStub::GetProp_CallDOMProxyNative) { - return ICGetProp_CallDOMProxyNative::New( + return ICStub::New( space, getStubCode(), firstMonitorStub_, shape, proxy_->handler(), expandoShape, holder_, holderShape, getter_, pcOffset_); } - return ICGetProp_CallDOMProxyWithGenerationNative::New( + return ICStub::New( space, getStubCode(), firstMonitorStub_, shape, proxy_->handler(), expandoAndGeneration, generation, expandoShape, holder_, holderShape, getter_, pcOffset_); @@ -7674,7 +7674,7 @@ ICStub * ICGetProp_DOMProxyShadowed::Compiler::getStub(ICStubSpace *space) { RootedShape shape(cx, proxy_->lastProperty()); - return ICGetProp_DOMProxyShadowed::New(space, getStubCode(), firstMonitorStub_, shape, + return New(space, getStubCode(), firstMonitorStub_, shape, proxy_->handler(), name_, pcOffset_); } @@ -7842,7 +7842,7 @@ ICGetProp_ArgumentsCallee::Compiler::generateStubCode(MacroAssembler &masm) ICGetProp_Generic::Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICGetProp_Generic &other) { - return New(space, other.jitCode(), firstMonitorStub); + return New(space, other.jitCode(), firstMonitorStub); } static bool @@ -11059,7 +11059,7 @@ ICTableSwitch::Compiler::getStub(ICStubSpace *space) pc += JUMP_OFFSET_LEN; } - return ICTableSwitch::New(space, code, table, low, length, defaultpc); + return ICStub::New(space, code, table, low, length, defaultpc); } void @@ -11679,8 +11679,10 @@ ICGetElem_NativePrototypeCallNative::Clone(JSContext *cx, ICStubSpace *space, RootedFunction getter(cx, other.getter()); RootedObject holder(cx, other.holder()); RootedShape holderShape(cx, other.holderShape()); - return New(space, other.jitCode(), firstMonitorStub, shape, name, other.accessType(), - other.needsAtomize(), getter, other.pcOffset_, holder, holderShape); + return New(space, other.jitCode(), firstMonitorStub, + shape, name, other.accessType(), + other.needsAtomize(), getter, other.pcOffset_, + holder, holderShape); } /* static */ ICGetElem_NativePrototypeCallScripted * @@ -11693,8 +11695,9 @@ ICGetElem_NativePrototypeCallScripted::Clone(JSContext *cx, ICStubSpace *space, RootedFunction getter(cx, other.getter()); RootedObject holder(cx, other.holder()); RootedShape holderShape(cx, other.holderShape()); - return New(space, other.jitCode(), firstMonitorStub, shape, name, other.accessType(), - other.needsAtomize(), getter, other.pcOffset_, holder, holderShape); + return New(space, other.jitCode(), firstMonitorStub, shape, name, + other.accessType(), other.needsAtomize(), getter, + other.pcOffset_, holder, holderShape); } ICGetElem_Dense::ICGetElem_Dense(JitCode *stubCode, ICStub *firstMonitorStub, HandleShape shape) @@ -11707,7 +11710,7 @@ ICGetElem_Dense::Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorSt ICGetElem_Dense &other) { RootedShape shape(cx, other.shape_); - return New(space, other.jitCode(), firstMonitorStub, shape); + return New(space, other.jitCode(), firstMonitorStub, shape); } ICGetElem_TypedArray::ICGetElem_TypedArray(JitCode *stubCode, HandleShape shape, Scalar::Type type) @@ -11722,7 +11725,7 @@ ICGetElem_TypedArray::ICGetElem_TypedArray(JitCode *stubCode, HandleShape shape, ICGetElem_Arguments::Clone(JSContext *, ICStubSpace *space, ICStub *firstMonitorStub, ICGetElem_Arguments &other) { - return New(space, other.jitCode(), firstMonitorStub, other.which()); + return New(space, other.jitCode(), firstMonitorStub, other.which()); } ICSetElem_Dense::ICSetElem_Dense(JitCode *stubCode, HandleShape shape, HandleObjectGroup group) @@ -11748,7 +11751,7 @@ ICSetElemDenseAddCompiler::getStubSpecific(ICStubSpace *space, const AutoShapeVe if (!group) return nullptr; Rooted stubCode(cx, getStubCode()); - return ICSetElem_DenseAddImpl::New(space, stubCode, group, shapes); + return ICStub::New>(space, stubCode, group, shapes); } ICSetElem_TypedArray::ICSetElem_TypedArray(JitCode *stubCode, HandleShape shape, Scalar::Type type, @@ -11806,7 +11809,7 @@ ICGetProp_Native::Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorS ICGetProp_Native &other) { RootedShape shape(cx, other.shape()); - return New(space, other.jitCode(), firstMonitorStub, shape, other.offset()); + return New(space, other.jitCode(), firstMonitorStub, shape, other.offset()); } ICGetProp_NativePrototype::ICGetProp_NativePrototype(JitCode *stubCode, ICStub *firstMonitorStub, @@ -11825,8 +11828,8 @@ ICGetProp_NativePrototype::Clone(JSContext *cx, ICStubSpace *space, ICStub *firs RootedShape shape(cx, other.shape()); RootedObject holder(cx, other.holder_); RootedShape holderShape(cx, other.holderShape_); - return New(space, other.jitCode(), firstMonitorStub, shape, other.offset(), - holder, holderShape); + return New(space, other.jitCode(), firstMonitorStub, shape, + other.offset(), holder, holderShape); } ICGetProp_UnboxedPrototype::ICGetProp_UnboxedPrototype(JitCode *stubCode, ICStub *firstMonitorStub, @@ -11845,8 +11848,8 @@ ICGetProp_UnboxedPrototype::Clone(JSContext *cx, ICStubSpace *space, ICStub *fir RootedObjectGroup group(cx, other.group()); RootedObject holder(cx, other.holder_); RootedShape holderShape(cx, other.holderShape_); - return New(space, other.jitCode(), firstMonitorStub, group, other.offset(), - holder, holderShape); + return New(space, other.jitCode(), firstMonitorStub, group, + other.offset(), holder, holderShape); } ICGetProp_NativeDoesNotExist::ICGetProp_NativeDoesNotExist( @@ -11929,8 +11932,8 @@ ICGetProp_CallScripted::Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMo RootedObject holder(cx, other.holder_); RootedShape holderShape(cx, other.holderShape_); RootedFunction getter(cx, other.getter_); - return New(space, other.jitCode(), firstMonitorStub, receiverShape, holder, - holderShape, getter, other.pcOffset_); + return New(space, other.jitCode(), firstMonitorStub, receiverShape, + holder, holderShape, getter, other.pcOffset_); } /* static */ ICGetProp_CallNative * @@ -11940,8 +11943,8 @@ ICGetProp_CallNative::Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMoni RootedObject holder(cx, other.holder_); RootedShape holderShape(cx, other.holderShape_); RootedFunction getter(cx, other.getter_); - return New(space, other.jitCode(), firstMonitorStub, holder, holderShape, getter, - other.pcOffset_); + return New(space, other.jitCode(), firstMonitorStub, holder, holderShape, + getter, other.pcOffset_); } /* static */ ICGetProp_CallNativePrototype * @@ -11952,8 +11955,8 @@ ICGetProp_CallNativePrototype::Clone(JSContext *cx, ICStubSpace *space, ICStub * RootedObject holder(cx, other.holder_); RootedShape holderShape(cx, other.holderShape_); RootedFunction getter(cx, other.getter_); - return New(space, other.jitCode(), firstMonitorStub, receiverShape, holder, - holderShape, getter, other.pcOffset_); + return New(space, other.jitCode(), firstMonitorStub, receiverShape, + holder, holderShape, getter, other.pcOffset_); } ICSetProp_Native::ICSetProp_Native(JitCode *stubCode, HandleObjectGroup group, HandleShape shape, @@ -11972,7 +11975,7 @@ ICSetProp_Native::Compiler::getStub(ICStubSpace *space) return nullptr; RootedShape shape(cx, obj_->lastProperty()); - ICSetProp_Native *stub = ICSetProp_Native::New(space, getStubCode(), group, shape, offset_); + ICSetProp_Native *stub = ICStub::New(space, getStubCode(), group, shape, offset_); if (!stub || !stub->initUpdatingChain(cx, space)) return nullptr; return stub; @@ -12045,7 +12048,8 @@ ICSetProp_CallScripted::Clone(JSContext *cx, ICStubSpace *space, ICStub *, RootedObject holder(cx, other.holder_); RootedShape holderShape(cx, other.holderShape_); RootedFunction setter(cx, other.setter_); - return New(space, other.jitCode(), shape, holder, holderShape, setter, other.pcOffset_); + return New(space, other.jitCode(), shape, holder, holderShape, setter, + other.pcOffset_); } /* static */ ICSetProp_CallNative * @@ -12056,7 +12060,8 @@ ICSetProp_CallNative::Clone(JSContext *cx, ICStubSpace *space, ICStub *, RootedObject holder(cx, other.holder_); RootedShape holderShape(cx, other.holderShape_); RootedFunction setter(cx, other.setter_); - return New(space, other.jitCode(), shape, holder, holderShape, setter, other.pcOffset_); + return New(space, other.jitCode(), shape, holder, holderShape, setter, + other.pcOffset_); } ICCall_Scripted::ICCall_Scripted(JitCode *stubCode, ICStub *firstMonitorStub, @@ -12074,15 +12079,15 @@ ICCall_Scripted::Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorSt { RootedFunction callee(cx, other.callee_); RootedObject templateObject(cx, other.templateObject_); - return New(space, other.jitCode(), firstMonitorStub, callee, templateObject, - other.pcOffset_); + return New(space, other.jitCode(), firstMonitorStub, callee, templateObject, + other.pcOffset_); } /* static */ ICCall_AnyScripted * ICCall_AnyScripted::Clone(JSContext *, ICStubSpace *space, ICStub *firstMonitorStub, ICCall_AnyScripted &other) { - return New(space, other.jitCode(), firstMonitorStub, other.pcOffset_); + return New(space, other.jitCode(), firstMonitorStub, other.pcOffset_); } ICCall_Native::ICCall_Native(JitCode *stubCode, ICStub *firstMonitorStub, @@ -12108,8 +12113,8 @@ ICCall_Native::Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub { RootedFunction callee(cx, other.callee_); RootedObject templateObject(cx, other.templateObject_); - return New(space, other.jitCode(), firstMonitorStub, callee, templateObject, - other.pcOffset_); + return New(space, other.jitCode(), firstMonitorStub, callee, templateObject, + other.pcOffset_); } ICCall_ClassHook::ICCall_ClassHook(JitCode *stubCode, ICStub *firstMonitorStub, @@ -12134,8 +12139,9 @@ ICCall_ClassHook::Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorS ICCall_ClassHook &other) { RootedObject templateObject(cx, other.templateObject_); - ICCall_ClassHook *res = New(space, other.jitCode(), firstMonitorStub, - other.clasp(), nullptr, templateObject, other.pcOffset_); + ICCall_ClassHook *res = New(space, other.jitCode(), firstMonitorStub, + other.clasp(), nullptr, templateObject, + other.pcOffset_); if (res) res->native_ = other.native(); return res; @@ -12145,7 +12151,8 @@ ICCall_ClassHook::Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorS ICCall_ScriptedApplyArray::Clone(JSContext *, ICStubSpace *space, ICStub *firstMonitorStub, ICCall_ScriptedApplyArray &other) { - return New(space, other.jitCode(), firstMonitorStub, other.pcOffset_); + return New(space, other.jitCode(), firstMonitorStub, + other.pcOffset_); } /* static */ ICCall_ScriptedApplyArguments * @@ -12153,14 +12160,15 @@ ICCall_ScriptedApplyArguments::Clone(JSContext *, ICStubSpace *space, ICStub *firstMonitorStub, ICCall_ScriptedApplyArguments &other) { - return New(space, other.jitCode(), firstMonitorStub, other.pcOffset_); + return New(space, other.jitCode(), firstMonitorStub, + other.pcOffset_); } /* static */ ICCall_ScriptedFunCall * ICCall_ScriptedFunCall::Clone(JSContext *, ICStubSpace *space, ICStub *firstMonitorStub, ICCall_ScriptedFunCall &other) { - return New(space, other.jitCode(), firstMonitorStub, other.pcOffset_); + return New(space, other.jitCode(), firstMonitorStub, other.pcOffset_); } ICGetPropCallDOMProxyNativeStub::ICGetPropCallDOMProxyNativeStub(Kind kind, JitCode *stubCode, @@ -12207,8 +12215,9 @@ ICGetProp_CallDOMProxyNative::Clone(JSContext *cx, ICStubSpace *space, ICStub *f RootedObject holder(cx, other.holder_); RootedShape holderShape(cx, other.holderShape_); RootedFunction getter(cx, other.getter_); - return New(space, other.jitCode(), firstMonitorStub, shape, other.proxyHandler_, - expandoShape, holder, holderShape, getter, other.pcOffset_); + return New(space, other.jitCode(), firstMonitorStub, shape, + other.proxyHandler_, expandoShape, holder, + holderShape, getter, other.pcOffset_); } /* static */ ICGetProp_CallDOMProxyWithGenerationNative * @@ -12221,9 +12230,11 @@ ICGetProp_CallDOMProxyWithGenerationNative::Clone(JSContext *cx, ICStubSpace *sp RootedObject holder(cx, other.holder_); RootedShape holderShape(cx, other.holderShape_); RootedFunction getter(cx, other.getter_); - return New(space, other.jitCode(), firstMonitorStub, shape, other.proxyHandler_, - other.expandoAndGeneration_, other.generation_, - expandoShape, holder, holderShape, getter, other.pcOffset_); + return New(space, other.jitCode(), firstMonitorStub, + shape, other.proxyHandler_, + other.expandoAndGeneration_, other.generation_, + expandoShape, holder, holderShape, getter, + other.pcOffset_); } ICGetProp_DOMProxyShadowed::ICGetProp_DOMProxyShadowed(JitCode *stubCode, @@ -12245,8 +12256,8 @@ ICGetProp_DOMProxyShadowed::Clone(JSContext *cx, ICStubSpace *space, ICStub *fir { RootedShape shape(cx, other.shape_); RootedPropertyName name(cx, other.name_); - return New(space, other.jitCode(), firstMonitorStub, shape, other.proxyHandler_, - name, other.pcOffset_); + return New(space, other.jitCode(), firstMonitorStub, shape, + other.proxyHandler_, name, other.pcOffset_); } // diff --git a/js/src/jit/BaselineIC.h b/js/src/jit/BaselineIC.h index abcfc93d171d..1d66e44b4f6d 100644 --- a/js/src/jit/BaselineIC.h +++ b/js/src/jit/BaselineIC.h @@ -632,6 +632,13 @@ class ICStub void updateCode(JitCode *stubCode); void trace(JSTracer *trc); + template + static T *New(ICStubSpace *space, JitCode *code, Args&&... args) { + if (!code) + return nullptr; + return space->allocate(code, mozilla::Forward(args)...); + } + protected: // The raw jitcode to call for this stub. uint8_t *stubCode_; @@ -1202,12 +1209,6 @@ class ICWarmUpCounter_Fallback : public ICFallbackStub { } public: - static inline ICWarmUpCounter_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: @@ -1219,7 +1220,7 @@ class ICWarmUpCounter_Fallback : public ICFallbackStub { } ICWarmUpCounter_Fallback *getStub(ICStubSpace *space) { - return ICWarmUpCounter_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -1380,15 +1381,6 @@ class ICTypeMonitor_Fallback : public ICStub } public: - static inline ICTypeMonitor_Fallback *New( - ICStubSpace *space, JitCode *code, ICMonitoredFallbackStub *mainFbStub, - uint32_t argumentIndex) - { - if (!code) - return nullptr; - return space->allocate(code, mainFbStub, argumentIndex); - } - bool hasStub(ICStub::Kind kind) { ICStub *stub = firstMonitorStub_; do { @@ -1475,8 +1467,8 @@ class ICTypeMonitor_Fallback : public ICStub { } ICTypeMonitor_Fallback *getStub(ICStubSpace *space) { - return ICTypeMonitor_Fallback::New(space, getStubCode(), mainFallbackStub_, - argumentIndex_); + return ICStub::New(space, getStubCode(), mainFallbackStub_, + argumentIndex_); } }; }; @@ -1490,14 +1482,6 @@ class ICTypeMonitor_PrimitiveSet : public TypeCheckPrimitiveSetStub {} public: - static inline ICTypeMonitor_PrimitiveSet *New(ICStubSpace *space, JitCode *code, - uint16_t flags) - { - if (!code) - return nullptr; - return space->allocate(code, flags); - } - class Compiler : public TypeCheckPrimitiveSetStub::Compiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -1517,7 +1501,7 @@ class ICTypeMonitor_PrimitiveSet : public TypeCheckPrimitiveSetStub ICTypeMonitor_PrimitiveSet *getStub(ICStubSpace *space) { MOZ_ASSERT(!existingStub_); - return ICTypeMonitor_PrimitiveSet::New(space, getStubCode(), flags_); + return ICStub::New(space, getStubCode(), flags_); } }; }; @@ -1531,14 +1515,6 @@ class ICTypeMonitor_SingleObject : public ICStub ICTypeMonitor_SingleObject(JitCode *stubCode, HandleObject obj); public: - static inline ICTypeMonitor_SingleObject *New( - ICStubSpace *space, JitCode *code, HandleObject obj) - { - if (!code) - return nullptr; - return space->allocate(code, obj); - } - HeapPtrObject &object() { return obj_; } @@ -1559,7 +1535,7 @@ class ICTypeMonitor_SingleObject : public ICStub { } ICTypeMonitor_SingleObject *getStub(ICStubSpace *space) { - return ICTypeMonitor_SingleObject::New(space, getStubCode(), obj_); + return ICStub::New(space, getStubCode(), obj_); } }; }; @@ -1573,14 +1549,6 @@ class ICTypeMonitor_ObjectGroup : public ICStub ICTypeMonitor_ObjectGroup(JitCode *stubCode, HandleObjectGroup group); public: - static inline ICTypeMonitor_ObjectGroup *New( - ICStubSpace *space, JitCode *code, HandleObjectGroup group) - { - if (!code) - return nullptr; - return space->allocate(code, group); - } - HeapPtrObjectGroup &group() { return group_; } @@ -1601,7 +1569,7 @@ class ICTypeMonitor_ObjectGroup : public ICStub { } ICTypeMonitor_ObjectGroup *getStub(ICStubSpace *space) { - return ICTypeMonitor_ObjectGroup::New(space, getStubCode(), group_); + return ICStub::New(space, getStubCode(), group_); } }; }; @@ -1621,12 +1589,6 @@ class ICTypeUpdate_Fallback : public ICStub {} public: - static inline ICTypeUpdate_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: @@ -1638,7 +1600,7 @@ class ICTypeUpdate_Fallback : public ICStub { } ICTypeUpdate_Fallback *getStub(ICStubSpace *space) { - return ICTypeUpdate_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -1652,14 +1614,6 @@ class ICTypeUpdate_PrimitiveSet : public TypeCheckPrimitiveSetStub {} public: - static inline ICTypeUpdate_PrimitiveSet *New(ICStubSpace *space, JitCode *code, - uint16_t flags) - { - if (!code) - return nullptr; - return space->allocate(code, flags); - } - class Compiler : public TypeCheckPrimitiveSetStub::Compiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -1679,7 +1633,7 @@ class ICTypeUpdate_PrimitiveSet : public TypeCheckPrimitiveSetStub ICTypeUpdate_PrimitiveSet *getStub(ICStubSpace *space) { MOZ_ASSERT(!existingStub_); - return ICTypeUpdate_PrimitiveSet::New(space, getStubCode(), flags_); + return ICStub::New(space, getStubCode(), flags_); } }; }; @@ -1694,14 +1648,6 @@ class ICTypeUpdate_SingleObject : public ICStub ICTypeUpdate_SingleObject(JitCode *stubCode, HandleObject obj); public: - static inline ICTypeUpdate_SingleObject *New(ICStubSpace *space, JitCode *code, - HandleObject obj) - { - if (!code) - return nullptr; - return space->allocate(code, obj); - } - HeapPtrObject &object() { return obj_; } @@ -1722,7 +1668,7 @@ class ICTypeUpdate_SingleObject : public ICStub { } ICTypeUpdate_SingleObject *getStub(ICStubSpace *space) { - return ICTypeUpdate_SingleObject::New(space, getStubCode(), obj_); + return ICStub::New(space, getStubCode(), obj_); } }; }; @@ -1737,14 +1683,6 @@ class ICTypeUpdate_ObjectGroup : public ICStub ICTypeUpdate_ObjectGroup(JitCode *stubCode, HandleObjectGroup group); public: - static inline ICTypeUpdate_ObjectGroup *New(ICStubSpace *space, JitCode *code, - HandleObjectGroup group) - { - if (!code) - return nullptr; - return space->allocate(code, group); - } - HeapPtrObjectGroup &group() { return group_; } @@ -1765,7 +1703,7 @@ class ICTypeUpdate_ObjectGroup : public ICStub { } ICTypeUpdate_ObjectGroup *getStub(ICStubSpace *space) { - return ICTypeUpdate_ObjectGroup::New(space, getStubCode(), group_); + return ICStub::New(space, getStubCode(), group_); } }; }; @@ -1781,12 +1719,6 @@ class ICThis_Fallback : public ICFallbackStub : ICFallbackStub(ICStub::This_Fallback, stubCode) {} public: - static inline ICThis_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: @@ -1797,7 +1729,7 @@ class ICThis_Fallback : public ICFallbackStub : ICStubCompiler(cx, ICStub::This_Fallback) {} ICStub *getStub(ICStubSpace *space) { - return ICThis_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -1813,13 +1745,6 @@ class ICNewArray_Fallback : public ICFallbackStub {} public: - static inline ICNewArray_Fallback *New(ICStubSpace *space, JitCode *code, - ArrayObject *templateObject) { - if (!code) - return nullptr; - return space->allocate(code, templateObject); - } - class Compiler : public ICStubCompiler { RootedArrayObject templateObject; bool generateStubCode(MacroAssembler &masm); @@ -1831,7 +1756,7 @@ class ICNewArray_Fallback : public ICFallbackStub {} ICStub *getStub(ICStubSpace *space) { - return ICNewArray_Fallback::New(space, getStubCode(), templateObject); + return ICStub::New(space, getStubCode(), templateObject); } }; @@ -1851,13 +1776,6 @@ class ICNewObject_Fallback : public ICFallbackStub {} public: - static inline ICNewObject_Fallback *New(ICStubSpace *space, JitCode *code, - PlainObject *templateObject) { - if (!code) - return nullptr; - return space->allocate(code, templateObject); - } - class Compiler : public ICStubCompiler { RootedPlainObject templateObject; bool generateStubCode(MacroAssembler &masm); @@ -1869,7 +1787,7 @@ class ICNewObject_Fallback : public ICFallbackStub {} ICStub *getStub(ICStubSpace *space) { - return ICNewObject_Fallback::New(space, getStubCode(), templateObject); + return ICStub::New(space, getStubCode(), templateObject); } }; @@ -1892,12 +1810,6 @@ class ICCompare_Fallback : public ICFallbackStub public: static const uint32_t MAX_OPTIMIZED_STUBS = 8; - static inline ICCompare_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - static const size_t UNOPTIMIZABLE_ACCESS_BIT = 0; void noteUnoptimizableAccess() { extra_ |= (1u << UNOPTIMIZABLE_ACCESS_BIT); @@ -1916,7 +1828,7 @@ class ICCompare_Fallback : public ICFallbackStub : ICStubCompiler(cx, ICStub::Compare_Fallback) {} ICStub *getStub(ICStubSpace *space) { - return ICCompare_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -1929,12 +1841,6 @@ class ICCompare_Int32 : public ICStub : ICStub(ICStub::Compare_Int32, stubCode) {} public: - static inline ICCompare_Int32 *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - // Compiler for this stub kind. class Compiler : public ICMultiStubCompiler { protected: @@ -1945,7 +1851,7 @@ class ICCompare_Int32 : public ICStub : ICMultiStubCompiler(cx, ICStub::Compare_Int32, op) {} ICStub *getStub(ICStubSpace *space) { - return ICCompare_Int32::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -1959,12 +1865,6 @@ class ICCompare_Double : public ICStub {} public: - static inline ICCompare_Double *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICMultiStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -1975,7 +1875,7 @@ class ICCompare_Double : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICCompare_Double::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -1991,12 +1891,6 @@ class ICCompare_NumberWithUndefined : public ICStub } public: - static inline ICCompare_NumberWithUndefined *New(ICStubSpace *space, JitCode *code, bool lhsIsUndefined) { - if (!code) - return nullptr; - return space->allocate(code, lhsIsUndefined); - } - bool lhsIsUndefined() { return extra_; } @@ -2020,7 +1914,7 @@ class ICCompare_NumberWithUndefined : public ICStub } ICStub *getStub(ICStubSpace *space) { - return ICCompare_NumberWithUndefined::New(space, getStubCode(), lhsIsUndefined); + return ICStub::New(space, getStubCode(), lhsIsUndefined); } }; }; @@ -2034,12 +1928,6 @@ class ICCompare_String : public ICStub {} public: - static inline ICCompare_String *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICMultiStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -2050,7 +1938,7 @@ class ICCompare_String : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICCompare_String::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2064,12 +1952,6 @@ class ICCompare_Boolean : public ICStub {} public: - static inline ICCompare_Boolean *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICMultiStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -2080,7 +1962,7 @@ class ICCompare_Boolean : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICCompare_Boolean::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2094,12 +1976,6 @@ class ICCompare_Object : public ICStub {} public: - static inline ICCompare_Object *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICMultiStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -2110,7 +1986,7 @@ class ICCompare_Object : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICCompare_Object::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2124,12 +2000,6 @@ class ICCompare_ObjectWithUndefined : public ICStub {} public: - static inline ICCompare_ObjectWithUndefined *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICMultiStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -2152,7 +2022,7 @@ class ICCompare_ObjectWithUndefined : public ICStub } ICStub *getStub(ICStubSpace *space) { - return ICCompare_ObjectWithUndefined::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2168,14 +2038,6 @@ class ICCompare_Int32WithBoolean : public ICStub } public: - static inline ICCompare_Int32WithBoolean *New(ICStubSpace *space, JitCode *code, - bool lhsIsInt32) - { - if (!code) - return nullptr; - return space->allocate(code, lhsIsInt32); - } - bool lhsIsInt32() const { return extra_; } @@ -2200,7 +2062,7 @@ class ICCompare_Int32WithBoolean : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICCompare_Int32WithBoolean::New(space, getStubCode(), lhsIsInt32_); + return ICStub::New(space, getStubCode(), lhsIsInt32_); } }; }; @@ -2218,12 +2080,6 @@ class ICToBool_Fallback : public ICFallbackStub public: static const uint32_t MAX_OPTIMIZED_STUBS = 8; - static inline ICToBool_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: @@ -2234,7 +2090,7 @@ class ICToBool_Fallback : public ICFallbackStub : ICStubCompiler(cx, ICStub::ToBool_Fallback) {} ICStub *getStub(ICStubSpace *space) { - return ICToBool_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2247,12 +2103,6 @@ class ICToBool_Int32 : public ICStub : ICStub(ICStub::ToBool_Int32, stubCode) {} public: - static inline ICToBool_Int32 *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: @@ -2263,7 +2113,7 @@ class ICToBool_Int32 : public ICStub : ICStubCompiler(cx, ICStub::ToBool_Int32) {} ICStub *getStub(ICStubSpace *space) { - return ICToBool_Int32::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2276,12 +2126,6 @@ class ICToBool_String : public ICStub : ICStub(ICStub::ToBool_String, stubCode) {} public: - static inline ICToBool_String *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: @@ -2292,7 +2136,7 @@ class ICToBool_String : public ICStub : ICStubCompiler(cx, ICStub::ToBool_String) {} ICStub *getStub(ICStubSpace *space) { - return ICToBool_String::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2305,12 +2149,6 @@ class ICToBool_NullUndefined : public ICStub : ICStub(ICStub::ToBool_NullUndefined, stubCode) {} public: - static inline ICToBool_NullUndefined *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: @@ -2321,7 +2159,7 @@ class ICToBool_NullUndefined : public ICStub : ICStubCompiler(cx, ICStub::ToBool_NullUndefined) {} ICStub *getStub(ICStubSpace *space) { - return ICToBool_NullUndefined::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2334,12 +2172,6 @@ class ICToBool_Double : public ICStub : ICStub(ICStub::ToBool_Double, stubCode) {} public: - static inline ICToBool_Double *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: @@ -2350,7 +2182,7 @@ class ICToBool_Double : public ICStub : ICStubCompiler(cx, ICStub::ToBool_Double) {} ICStub *getStub(ICStubSpace *space) { - return ICToBool_Double::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2363,12 +2195,6 @@ class ICToBool_Object : public ICStub : ICStub(ICStub::ToBool_Object, stubCode) {} public: - static inline ICToBool_Object *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: @@ -2379,7 +2205,7 @@ class ICToBool_Object : public ICStub : ICStubCompiler(cx, ICStub::ToBool_Object) {} ICStub *getStub(ICStubSpace *space) { - return ICToBool_Object::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2395,12 +2221,6 @@ class ICToNumber_Fallback : public ICFallbackStub : ICFallbackStub(ICStub::ToNumber_Fallback, stubCode) {} public: - static inline ICToNumber_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: @@ -2411,7 +2231,7 @@ class ICToNumber_Fallback : public ICFallbackStub : ICStubCompiler(cx, ICStub::ToNumber_Fallback) {} ICStub *getStub(ICStubSpace *space) { - return ICToNumber_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2437,12 +2257,6 @@ class ICBinaryArith_Fallback : public ICFallbackStub public: static const uint32_t MAX_OPTIMIZED_STUBS = 8; - static inline ICBinaryArith_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - bool sawDoubleResult() const { return extra_ & SAW_DOUBLE_RESULT_BIT; } @@ -2466,7 +2280,7 @@ class ICBinaryArith_Fallback : public ICFallbackStub : ICStubCompiler(cx, ICStub::BinaryArith_Fallback) {} ICStub *getStub(ICStubSpace *space) { - return ICBinaryArith_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2482,11 +2296,6 @@ class ICBinaryArith_Int32 : public ICStub } public: - static inline ICBinaryArith_Int32 *New(ICStubSpace *space, JitCode *code, bool allowDouble) { - if (!code) - return nullptr; - return space->allocate(code, allowDouble); - } bool allowDouble() const { return extra_; } @@ -2511,7 +2320,7 @@ class ICBinaryArith_Int32 : public ICStub op_(op), allowDouble_(allowDouble) {} ICStub *getStub(ICStubSpace *space) { - return ICBinaryArith_Int32::New(space, getStubCode(), allowDouble_); + return ICStub::New(space, getStubCode(), allowDouble_); } }; }; @@ -2525,12 +2334,6 @@ class ICBinaryArith_StringConcat : public ICStub {} public: - static inline ICBinaryArith_StringConcat *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -2541,7 +2344,7 @@ class ICBinaryArith_StringConcat : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICBinaryArith_StringConcat::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2557,13 +2360,6 @@ class ICBinaryArith_StringObjectConcat : public ICStub } public: - static inline ICBinaryArith_StringObjectConcat *New(ICStubSpace *space, JitCode *code, - bool lhsIsString) { - if (!code) - return nullptr; - return space->allocate(code, lhsIsString); - } - bool lhsIsString() const { return extra_; } @@ -2584,7 +2380,7 @@ class ICBinaryArith_StringObjectConcat : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICBinaryArith_StringObjectConcat::New(space, getStubCode(), lhsIsString_); + return ICStub::New(space, getStubCode(), lhsIsString_); } }; }; @@ -2598,12 +2394,6 @@ class ICBinaryArith_Double : public ICStub {} public: - static inline ICBinaryArith_Double *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICMultiStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -2614,7 +2404,7 @@ class ICBinaryArith_Double : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICBinaryArith_Double::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2635,13 +2425,6 @@ class ICBinaryArith_BooleanWithInt32 : public ICStub } public: - static inline ICBinaryArith_BooleanWithInt32 *New(ICStubSpace *space, JitCode *code, - bool lhsIsBool, bool rhsIsBool) { - if (!code) - return nullptr; - return space->allocate(code, lhsIsBool, rhsIsBool); - } - bool lhsIsBoolean() const { return extra_ & 1; } @@ -2674,8 +2457,8 @@ class ICBinaryArith_BooleanWithInt32 : public ICStub } ICStub *getStub(ICStubSpace *space) { - return ICBinaryArith_BooleanWithInt32::New(space, getStubCode(), - lhsIsBool_, rhsIsBool_); + return ICStub::New(space, getStubCode(), + lhsIsBool_, rhsIsBool_); } }; }; @@ -2691,13 +2474,6 @@ class ICBinaryArith_DoubleWithInt32 : public ICStub } public: - static inline ICBinaryArith_DoubleWithInt32 *New(ICStubSpace *space, JitCode *code, - bool lhsIsDouble) { - if (!code) - return nullptr; - return space->allocate(code, lhsIsDouble); - } - bool lhsIsDouble() const { return extra_; } @@ -2719,7 +2495,7 @@ class ICBinaryArith_DoubleWithInt32 : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICBinaryArith_DoubleWithInt32::New(space, getStubCode(), lhsIsDouble_); + return ICStub::New(space, getStubCode(), lhsIsDouble_); } }; }; @@ -2741,12 +2517,6 @@ class ICUnaryArith_Fallback : public ICFallbackStub public: static const uint32_t MAX_OPTIMIZED_STUBS = 8; - static inline ICUnaryArith_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - bool sawDoubleResult() { return extra_; } @@ -2765,7 +2535,7 @@ class ICUnaryArith_Fallback : public ICFallbackStub {} ICStub *getStub(ICStubSpace *space) { - return ICUnaryArith_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2779,12 +2549,6 @@ class ICUnaryArith_Int32 : public ICStub {} public: - static inline ICUnaryArith_Int32 *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICMultiStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -2795,7 +2559,7 @@ class ICUnaryArith_Int32 : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICUnaryArith_Int32::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2809,12 +2573,6 @@ class ICUnaryArith_Double : public ICStub {} public: - static inline ICUnaryArith_Double *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICMultiStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -2825,7 +2583,7 @@ class ICUnaryArith_Double : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICUnaryArith_Double::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -2847,12 +2605,6 @@ class ICGetElem_Fallback : public ICMonitoredFallbackStub public: static const uint32_t MAX_OPTIMIZED_STUBS = 16; - static inline ICGetElem_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - void noteNonNativeAccess() { extra_ |= EXTRA_NON_NATIVE; } @@ -2878,7 +2630,7 @@ class ICGetElem_Fallback : public ICMonitoredFallbackStub { } ICStub *getStub(ICStubSpace *space) { - ICGetElem_Fallback *stub = ICGetElem_Fallback::New(space, getStubCode()); + ICGetElem_Fallback *stub = ICStub::New(space, getStubCode()); if (!stub) return nullptr; if (!stub->initMonitoringChain(cx, space)) @@ -2990,18 +2742,6 @@ class ICGetElem_NativeSlot : public ICGetElemNativeSlotStub : ICGetElemNativeSlotStub(ICStub::GetElem_NativeSlot, stubCode, firstMonitorStub, shape, name, acctype, needsAtomize, offset) {} - - public: - static inline ICGetElem_NativeSlot *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, - HandleShape shape, HandlePropertyName name, - AccessType acctype, bool needsAtomize, uint32_t offset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, shape, name, - acctype, needsAtomize, offset); - } }; class ICGetElem_NativePrototypeSlot : public ICGetElemNativeSlotStub @@ -3016,20 +2756,6 @@ class ICGetElem_NativePrototypeSlot : public ICGetElemNativeSlotStub HandleObject holder, HandleShape holderShape); public: - static inline ICGetElem_NativePrototypeSlot *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, - HandleShape shape, HandlePropertyName name, - AccessType acctype, bool needsAtomize, - uint32_t offset, HandleObject holder, - HandleShape holderShape) - { - if (!code) - return nullptr; - return space->allocate( - code, firstMonitorStub, shape, name, acctype, needsAtomize, offset, holder, - holderShape); - } - HeapPtrObject &holder() { return holder_; } @@ -3090,19 +2816,6 @@ class ICGetElem_NativePrototypeCallNative : public ICGetElemNativePrototypeCallS {} public: - static inline ICGetElem_NativePrototypeCallNative *New( - ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - HandleShape shape, HandlePropertyName name, AccessType acctype, - bool needsAtomize, HandleFunction getter, uint32_t pcOffset, - HandleObject holder, HandleShape holderShape) - { - if (!code) - return nullptr; - return space->allocate( - code, firstMonitorStub, shape, name, acctype, needsAtomize, getter, - pcOffset, holder, holderShape); - } - static ICGetElem_NativePrototypeCallNative *Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICGetElem_NativePrototypeCallNative &other); @@ -3124,19 +2837,6 @@ class ICGetElem_NativePrototypeCallScripted : public ICGetElemNativePrototypeCal {} public: - static inline ICGetElem_NativePrototypeCallScripted *New( - ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - HandleShape shape, HandlePropertyName name, AccessType acctype, - bool needsAtomize, HandleFunction getter, uint32_t pcOffset, - HandleObject holder, HandleShape holderShape) - { - if (!code) - return nullptr; - return space->allocate( - code, firstMonitorStub, shape, name, acctype, needsAtomize, getter, - pcOffset, holder, holderShape); - } - static ICGetElem_NativePrototypeCallScripted * Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, @@ -3213,7 +2913,7 @@ class ICGetElemNativeCompiler : public ICStubCompiler RootedShape shape(cx, obj_->lastProperty()); if (kind == ICStub::GetElem_NativeSlot) { MOZ_ASSERT(obj_ == holder_); - return ICGetElem_NativeSlot::New( + return ICStub::New( space, getStubCode(), firstMonitorStub_, shape, name_, acctype_, needsAtomize_, offset_); } @@ -3221,20 +2921,20 @@ class ICGetElemNativeCompiler : public ICStubCompiler MOZ_ASSERT(obj_ != holder_); RootedShape holderShape(cx, holder_->lastProperty()); if (kind == ICStub::GetElem_NativePrototypeSlot) { - return ICGetElem_NativePrototypeSlot::New( + return ICStub::New( space, getStubCode(), firstMonitorStub_, shape, name_, acctype_, needsAtomize_, offset_, holder_, holderShape); } if (kind == ICStub::GetElem_NativePrototypeCallNative) { - return ICGetElem_NativePrototypeCallNative::New( + return ICStub::New( space, getStubCode(), firstMonitorStub_, shape, name_, acctype_, needsAtomize_, getter_, pcOffset_, holder_, holderShape); } MOZ_ASSERT(kind == ICStub::GetElem_NativePrototypeCallScripted); if (kind == ICStub::GetElem_NativePrototypeCallScripted) { - return ICGetElem_NativePrototypeCallScripted::New( + return ICStub::New( space, getStubCode(), firstMonitorStub_, shape, name_, acctype_, needsAtomize_, getter_, pcOffset_, holder_, holderShape); } @@ -3251,12 +2951,6 @@ class ICGetElem_String : public ICStub : ICStub(ICStub::GetElem_String, stubCode) {} public: - static inline ICGetElem_String *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - // Compiler for this stub kind. class Compiler : public ICStubCompiler { protected: @@ -3267,7 +2961,7 @@ class ICGetElem_String : public ICStub : ICStubCompiler(cx, ICStub::GetElem_String) {} ICStub *getStub(ICStubSpace *space) { - return ICGetElem_String::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -3281,14 +2975,6 @@ class ICGetElem_Dense : public ICMonitoredStub ICGetElem_Dense(JitCode *stubCode, ICStub *firstMonitorStub, HandleShape shape); public: - static inline ICGetElem_Dense *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, HandleShape shape) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, shape); - } - static ICGetElem_Dense *Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICGetElem_Dense &other); @@ -3325,7 +3011,7 @@ class ICGetElem_Dense : public ICMonitoredStub {} ICStub *getStub(ICStubSpace *space) { - return ICGetElem_Dense::New(space, getStubCode(), firstMonitorStub_, shape_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, shape_); } }; }; @@ -3360,14 +3046,6 @@ class ICGetElem_TypedArray : public ICStub ICGetElem_TypedArray(JitCode *stubCode, HandleShape shape, Scalar::Type type); public: - static inline ICGetElem_TypedArray *New(ICStubSpace *space, JitCode *code, - HandleShape shape, Scalar::Type type) - { - if (!code) - return nullptr; - return space->allocate(code, shape, type); - } - static size_t offsetOfShape() { return offsetof(ICGetElem_TypedArray, shape_); } @@ -3399,7 +3077,7 @@ class ICGetElem_TypedArray : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICGetElem_TypedArray::New(space, getStubCode(), shape_, type_); + return ICStub::New(space, getStubCode(), shape_, type_); } }; }; @@ -3418,14 +3096,6 @@ class ICGetElem_Arguments : public ICMonitoredStub } public: - static inline ICGetElem_Arguments *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, Which which) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, which); - } - static ICGetElem_Arguments *Clone(JSContext *, ICStubSpace *space, ICStub *firstMonitorStub, ICGetElem_Arguments &other); @@ -3460,7 +3130,7 @@ class ICGetElem_Arguments : public ICMonitoredStub {} ICStub *getStub(ICStubSpace *space) { - return ICGetElem_Arguments::New(space, getStubCode(), firstMonitorStub_, which_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, which_); } }; }; @@ -3480,12 +3150,6 @@ class ICSetElem_Fallback : public ICFallbackStub public: static const uint32_t MAX_OPTIMIZED_STUBS = 8; - static inline ICSetElem_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - void noteArrayWriteHole() { extra_ = 1; } @@ -3504,7 +3168,7 @@ class ICSetElem_Fallback : public ICFallbackStub { } ICStub *getStub(ICStubSpace *space) { - return ICSetElem_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -3519,13 +3183,6 @@ class ICSetElem_Dense : public ICUpdatedStub ICSetElem_Dense(JitCode *stubCode, HandleShape shape, HandleObjectGroup group); public: - static inline ICSetElem_Dense *New(ICStubSpace *space, JitCode *code, HandleShape shape, - HandleObjectGroup group) { - if (!code) - return nullptr; - return space->allocate(code, shape, group); - } - static size_t offsetOfShape() { return offsetof(ICSetElem_Dense, shape_); } @@ -3558,7 +3215,7 @@ class ICSetElem_Dense : public ICUpdatedStub {} ICUpdatedStub *getStub(ICStubSpace *space) { - ICSetElem_Dense *stub = ICSetElem_Dense::New(space, getStubCode(), shape_, group_); + ICSetElem_Dense *stub = ICStub::New(space, getStubCode(), shape_, group_); if (!stub || !stub->initUpdatingChain(cx, space)) return nullptr; return stub; @@ -3623,15 +3280,6 @@ class ICSetElem_DenseAddImpl : public ICSetElem_DenseAdd } public: - static inline ICSetElem_DenseAddImpl *New(ICStubSpace *space, JitCode *code, - ObjectGroup *group, - const AutoShapeVector *shapes) - { - if (!code) - return nullptr; - return space->allocate >(code, group, shapes); - } - void traceShapes(JSTracer *trc) { for (size_t i = 0; i < NumShapes; i++) MarkShape(trc, &shapes_[i], "baseline-setelem-denseadd-stub-shape"); @@ -3681,15 +3329,6 @@ class ICSetElem_TypedArray : public ICStub bool expectOutOfBounds); public: - static inline ICSetElem_TypedArray *New(ICStubSpace *space, JitCode *code, - HandleShape shape, Scalar::Type type, - bool expectOutOfBounds) - { - if (!code) - return nullptr; - return space->allocate(code, shape, type, expectOutOfBounds); - } - Scalar::Type type() const { return (Scalar::Type) (extra_ & 0xff); } @@ -3732,8 +3371,8 @@ class ICSetElem_TypedArray : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICSetElem_TypedArray::New(space, getStubCode(), shape_, type_, - expectOutOfBounds_); + return ICStub::New(space, getStubCode(), shape_, type_, + expectOutOfBounds_); } }; }; @@ -3749,12 +3388,6 @@ class ICIn_Fallback : public ICFallbackStub { } public: - static inline ICIn_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -3765,7 +3398,7 @@ class ICIn_Fallback : public ICFallbackStub { } ICStub *getStub(ICStubSpace *space) { - return ICIn_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -3783,13 +3416,6 @@ class ICGetName_Fallback : public ICMonitoredFallbackStub public: static const uint32_t MAX_OPTIMIZED_STUBS = 8; - - static inline ICGetName_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - static const size_t UNOPTIMIZABLE_ACCESS_BIT = 0; void noteUnoptimizableAccess() { @@ -3809,7 +3435,7 @@ class ICGetName_Fallback : public ICMonitoredFallbackStub { } ICStub *getStub(ICStubSpace *space) { - ICGetName_Fallback *stub = ICGetName_Fallback::New(space, getStubCode()); + ICGetName_Fallback *stub = ICStub::New(space, getStubCode()); if (!stub || !stub->initMonitoringChain(cx, space)) return nullptr; return stub; @@ -3829,14 +3455,6 @@ class ICGetName_Global : public ICMonitoredStub ICGetName_Global(JitCode *stubCode, ICStub *firstMonitorStub, HandleShape shape, uint32_t slot); public: - static inline ICGetName_Global *New(ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - HandleShape shape, uint32_t slot) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, shape, slot); - } - HeapPtrShape &shape() { return shape_; } @@ -3864,7 +3482,8 @@ class ICGetName_Global : public ICMonitoredStub {} ICStub *getStub(ICStubSpace *space) { - return ICGetName_Global::New(space, getStubCode(), firstMonitorStub_, shape_, slot_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, shape_, + slot_); } }; }; @@ -3891,14 +3510,6 @@ class ICGetName_Scope : public ICMonitoredStub } public: - static inline ICGetName_Scope *New(ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - AutoShapeVector *shapes, uint32_t offset) - { - if (!code) - return nullptr; - return space->allocate >(code, firstMonitorStub, shapes, offset); - } - void traceScopes(JSTracer *trc) { for (size_t i = 0; i < NumHops + 1; i++) MarkShape(trc, &shapes_[i], "baseline-scope-stub-shape"); @@ -3938,7 +3549,7 @@ class ICGetName_Scope : public ICMonitoredStub } ICStub *getStub(ICStubSpace *space) { - return ICGetName_Scope::New(space, getStubCode(), firstMonitorStub_, shapes_, offset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, shapes_, offset_); } }; }; @@ -3954,12 +3565,6 @@ class ICBindName_Fallback : public ICFallbackStub { } public: - static inline ICBindName_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -3970,7 +3575,7 @@ class ICBindName_Fallback : public ICFallbackStub { } ICStub *getStub(ICStubSpace *space) { - return ICBindName_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -3986,12 +3591,6 @@ class ICGetIntrinsic_Fallback : public ICMonitoredFallbackStub { } public: - static inline ICGetIntrinsic_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -4002,7 +3601,8 @@ class ICGetIntrinsic_Fallback : public ICMonitoredFallbackStub { } ICStub *getStub(ICStubSpace *space) { - ICGetIntrinsic_Fallback *stub = ICGetIntrinsic_Fallback::New(space, getStubCode()); + ICGetIntrinsic_Fallback *stub = + ICStub::New(space, getStubCode()); if (!stub || !stub->initMonitoringChain(cx, space)) return nullptr; return stub; @@ -4021,14 +3621,6 @@ class ICGetIntrinsic_Constant : public ICStub ~ICGetIntrinsic_Constant(); public: - static inline ICGetIntrinsic_Constant *New(ICStubSpace *space, JitCode *code, - HandleValue value) - { - if (!code) - return nullptr; - return space->allocate(code, value); - } - HeapValue &value() { return value_; } @@ -4048,7 +3640,7 @@ class ICGetIntrinsic_Constant : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICGetIntrinsic_Constant::New(space, getStubCode(), value_); + return ICStub::New(space, getStubCode(), value_); } }; }; @@ -4063,13 +3655,6 @@ class ICGetProp_Fallback : public ICMonitoredFallbackStub public: static const uint32_t MAX_OPTIMIZED_STUBS = 16; - - static inline ICGetProp_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - static const size_t UNOPTIMIZABLE_ACCESS_BIT = 0; static const size_t ACCESSED_GETTER_BIT = 1; @@ -4099,7 +3684,7 @@ class ICGetProp_Fallback : public ICMonitoredFallbackStub { } ICStub *getStub(ICStubSpace *space) { - ICGetProp_Fallback *stub = ICGetProp_Fallback::New(space, getStubCode()); + ICGetProp_Fallback *stub = ICStub::New(space, getStubCode()); if (!stub || !stub->initMonitoringChain(cx, space)) return nullptr; return stub; @@ -4117,13 +3702,6 @@ class ICGetProp_Generic : public ICMonitoredStub : ICMonitoredStub(ICStub::GetProp_Generic, stubCode, firstMonitorStub) {} public: - static inline ICGetProp_Generic *New(ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub) - { - if(!code) - return nullptr; - return space->allocate(code, firstMonitorStub); - } - static ICGetProp_Generic *Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICGetProp_Generic &other); @@ -4138,7 +3716,7 @@ class ICGetProp_Generic : public ICMonitoredStub {} ICStub *getStub(ICStubSpace *space) { - return ICGetProp_Generic::New(space, getStubCode(), firstMonitorStub_); + return ICStub::New(space, getStubCode(), firstMonitorStub_); } }; }; @@ -4153,12 +3731,6 @@ class ICGetProp_ArrayLength : public ICStub {} public: - static inline ICGetProp_ArrayLength *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICStubCompiler { bool generateStubCode(MacroAssembler &masm); @@ -4168,7 +3740,7 @@ class ICGetProp_ArrayLength : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICGetProp_ArrayLength::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -4189,14 +3761,6 @@ class ICGetProp_Primitive : public ICMonitoredStub HandleShape protoShape, uint32_t offset); public: - static inline ICGetProp_Primitive *New(ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - HandleShape protoShape, uint32_t offset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, protoShape, offset); - } - HeapPtrShape &protoShape() { return protoShape_; } @@ -4238,8 +3802,8 @@ class ICGetProp_Primitive : public ICMonitoredStub ICStub *getStub(ICStubSpace *space) { RootedShape protoShape(cx, prototype_->lastProperty()); - return ICGetProp_Primitive::New(space, getStubCode(), firstMonitorStub_, - protoShape, offset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, + protoShape, offset_); } }; }; @@ -4254,12 +3818,6 @@ class ICGetProp_StringLength : public ICStub {} public: - static inline ICGetProp_StringLength *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICStubCompiler { bool generateStubCode(MacroAssembler &masm); @@ -4269,7 +3827,7 @@ class ICGetProp_StringLength : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICGetProp_StringLength::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -4314,15 +3872,6 @@ class ICGetProp_Native : public ICGetPropNativeStub {} public: - static inline ICGetProp_Native *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, HandleShape shape, - uint32_t offset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, shape, offset); - } - HeapPtrShape &shape() { return shape_; } @@ -4353,17 +3902,6 @@ class ICGetProp_NativePrototype : public ICGetPropNativeStub uint32_t offset, HandleObject holder, HandleShape holderShape); public: - static inline ICGetProp_NativePrototype *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, HandleShape shape, - uint32_t offset, HandleObject holder, - HandleShape holderShape) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, shape, offset, - holder, holderShape); - } - static ICGetProp_NativePrototype *Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICGetProp_NativePrototype &other); @@ -4409,18 +3947,6 @@ class ICGetProp_UnboxedPrototype : public ICGetPropNativeStub uint32_t offset, HandleObject holder, HandleShape holderShape); public: - static inline ICGetProp_UnboxedPrototype *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, - HandleObjectGroup group, - uint32_t offset, HandleObject holder, - HandleShape holderShape) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, group, offset, - holder, holderShape); - } - static ICGetProp_UnboxedPrototype *Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICGetProp_UnboxedPrototype &other); @@ -4506,16 +4032,6 @@ class ICGetProp_NativeDoesNotExist : public ICMonitoredStub size_t protoChainDepth); public: - static inline ICGetProp_NativeDoesNotExist *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, - size_t protoChainDepth) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, - protoChainDepth); - } - size_t protoChainDepth() const { MOZ_ASSERT(extra_ <= MAX_PROTO_CHAIN_DEPTH); return extra_; @@ -4545,16 +4061,6 @@ class ICGetProp_NativeDoesNotExistImpl : public ICGetProp_NativeDoesNotExist const AutoShapeVector *shapes); public: - static inline ICGetProp_NativeDoesNotExistImpl *New( - ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - const AutoShapeVector *shapes) - { - if (!code) - return nullptr; - return space->allocate>( - code, firstMonitorStub, shapes); - } - void traceShapes(JSTracer *trc) { for (size_t i = 0; i < NumShapes; i++) MarkShape(trc, &shapes_[i], "baseline-getpropnativedoesnotexist-stub-shape"); @@ -4584,8 +4090,8 @@ class ICGetPropNativeDoesNotExistCompiler : public ICStubCompiler template ICStub *getStubSpecific(ICStubSpace *space, const AutoShapeVector *shapes) { - return ICGetProp_NativeDoesNotExistImpl::New(space, getStubCode(), - firstMonitorStub_, shapes); + return ICStub::New>(space, getStubCode(), + firstMonitorStub_, shapes); } ICStub *getStub(ICStubSpace *space); @@ -4607,15 +4113,6 @@ class ICGetProp_Unboxed : public ICMonitoredStub } public: - static inline ICGetProp_Unboxed *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, HandleObjectGroup group, - uint32_t fieldOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, group, fieldOffset); - } - HeapPtrObjectGroup &group() { return group_; } @@ -4651,8 +4148,8 @@ class ICGetProp_Unboxed : public ICMonitoredStub {} ICStub *getStub(ICStubSpace *space) { - return ICGetProp_Unboxed::New(space, getStubCode(), firstMonitorStub_, - group_, fieldOffset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, + group_, fieldOffset_); } }; }; @@ -4681,15 +4178,6 @@ class ICGetProp_TypedObject : public ICMonitoredStub } public: - static inline ICGetProp_TypedObject *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, HandleShape shape, - uint32_t fieldOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, shape, fieldOffset); - } - HeapPtrShape &shape() { return shape_; } @@ -4729,8 +4217,8 @@ class ICGetProp_TypedObject : public ICMonitoredStub {} ICStub *getStub(ICStubSpace *space) { - return ICGetProp_TypedObject::New(space, getStubCode(), firstMonitorStub_, - shape_, fieldOffset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, + shape_, fieldOffset_); } }; }; @@ -4867,18 +4355,6 @@ class ICGetProp_CallScripted : public ICGetPropCallPrototypeGetter {} public: - static inline ICGetProp_CallScripted *New( - ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - HandleShape receiverShape, HandleObject holder, HandleShape holderShape, - HandleFunction getter, uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, - receiverShape, holder, holderShape, getter, - pcOffset); - } - static ICGetProp_CallScripted *Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICGetProp_CallScripted &other); @@ -4897,8 +4373,9 @@ class ICGetProp_CallScripted : public ICGetPropCallPrototypeGetter ICStub *getStub(ICStubSpace *space) { RootedShape receiverShape(cx, receiver_->lastProperty()); RootedShape holderShape(cx, holder_->lastProperty()); - return ICGetProp_CallScripted::New(space, getStubCode(), firstMonitorStub_, receiverShape, - holder_, holderShape, getter_, pcOffset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, + receiverShape, holder_, holderShape, getter_, + pcOffset_); } }; }; @@ -4917,17 +4394,6 @@ class ICGetProp_CallNative : public ICGetPropCallGetter { } public: - static inline ICGetProp_CallNative *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, HandleObject obj, - HandleShape shape, HandleFunction getter, - uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, obj, shape, - getter, pcOffset); - } - static ICGetProp_CallNative *Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICGetProp_CallNative &other); @@ -4953,8 +4419,8 @@ class ICGetProp_CallNative : public ICGetPropCallGetter ICStub *getStub(ICStubSpace *space) { RootedShape shape(cx, holder_->lastProperty()); - return ICGetProp_CallNative::New(space, getStubCode(), firstMonitorStub_, holder_, - shape, getter_, pcOffset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, + holder_, shape, getter_, pcOffset_); } }; }; @@ -4973,18 +4439,6 @@ class ICGetProp_CallNativePrototype : public ICGetPropCallPrototypeGetter {} public: - static inline ICGetProp_CallNativePrototype *New( - ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - HandleShape receiverShape, HandleObject holder, HandleShape holderShape, - HandleFunction getter, uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, - receiverShape, holder, holderShape, - getter, pcOffset); - } - static ICGetProp_CallNativePrototype *Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICGetProp_CallNativePrototype &other); @@ -5012,8 +4466,9 @@ class ICGetProp_CallNativePrototype : public ICGetPropCallPrototypeGetter ICStub *getStub(ICStubSpace *space) { RootedShape receiverShape(cx, receiver_->lastProperty()); RootedShape holderShape(cx, holder_->lastProperty()); - return ICGetProp_CallNativePrototype::New(space, getStubCode(), firstMonitorStub_, receiverShape, - holder_, holderShape, getter_, pcOffset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, + receiverShape, holder_, holderShape, + getter_, pcOffset_); } }; }; @@ -5068,19 +4523,6 @@ class ICGetProp_CallDOMProxyNative : public ICGetPropCallDOMProxyNativeStub {} public: - static inline ICGetProp_CallDOMProxyNative *New( - ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - HandleShape shape, const BaseProxyHandler *proxyHandler, - HandleShape expandoShape, HandleObject holder, HandleShape holderShape, - HandleFunction getter, uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, shape, - proxyHandler, expandoShape, holder, - holderShape, getter, pcOffset); - } - static ICGetProp_CallDOMProxyNative *Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICGetProp_CallDOMProxyNative &other); @@ -5107,21 +4549,6 @@ class ICGetProp_CallDOMProxyWithGenerationNative : public ICGetPropCallDOMProxyN { } - static inline ICGetProp_CallDOMProxyWithGenerationNative *New( - ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - HandleShape shape, const BaseProxyHandler *proxyHandler, - ExpandoAndGeneration *expandoAndGeneration, uint32_t generation, - HandleShape expandoShape, HandleObject holder, HandleShape holderShape, - HandleFunction getter, uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, - shape, proxyHandler, expandoAndGeneration, - generation, expandoShape, holder, holderShape, - getter, pcOffset); - } - static ICGetProp_CallDOMProxyWithGenerationNative * Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICGetProp_CallDOMProxyWithGenerationNative &other); @@ -5179,17 +4606,6 @@ class ICGetProp_DOMProxyShadowed : public ICMonitoredStub uint32_t pcOffset); public: - static inline ICGetProp_DOMProxyShadowed *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, HandleShape shape, - const BaseProxyHandler *proxyHandler, - HandlePropertyName name, uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, shape, - proxyHandler, name, pcOffset); - } - static ICGetProp_DOMProxyShadowed *Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICGetProp_DOMProxyShadowed &other); @@ -5248,13 +4664,6 @@ class ICGetProp_ArgumentsLength : public ICStub { } public: - static inline ICGetProp_ArgumentsLength *New(ICStubSpace *space, JitCode *code) - { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICStubCompiler { protected: Which which_; @@ -5272,7 +4681,7 @@ class ICGetProp_ArgumentsLength : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICGetProp_ArgumentsLength::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -5285,14 +4694,6 @@ class ICGetProp_ArgumentsCallee : public ICMonitoredStub ICGetProp_ArgumentsCallee(JitCode *stubCode, ICStub *firstMonitorStub); public: - static inline ICGetProp_ArgumentsCallee *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub); - } - class Compiler : public ICStubCompiler { protected: ICStub *firstMonitorStub_; @@ -5305,7 +4706,7 @@ class ICGetProp_ArgumentsCallee : public ICMonitoredStub {} ICStub *getStub(ICStubSpace *space) { - return ICGetProp_ArgumentsCallee::New(space, getStubCode(), firstMonitorStub_); + return ICStub::New(space, getStubCode(), firstMonitorStub_); } }; }; @@ -5327,12 +4728,6 @@ class ICSetProp_Fallback : public ICFallbackStub public: static const uint32_t MAX_OPTIMIZED_STUBS = 8; - static inline ICSetProp_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - static const size_t UNOPTIMIZABLE_ACCESS_BIT = 0; void noteUnoptimizableAccess() { extra_ |= (1u << UNOPTIMIZABLE_ACCESS_BIT); @@ -5353,7 +4748,7 @@ class ICSetProp_Fallback : public ICFallbackStub { } ICStub *getStub(ICStubSpace *space) { - return ICSetProp_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -5371,13 +4766,6 @@ class ICSetProp_Native : public ICUpdatedStub ICSetProp_Native(JitCode *stubCode, HandleObjectGroup group, HandleShape shape, uint32_t offset); public: - static inline ICSetProp_Native *New(ICStubSpace *space, JitCode *code, HandleObjectGroup group, - HandleShape shape, uint32_t offset) - { - if (!code) - return nullptr; - return space->allocate(code, group, shape, offset); - } HeapPtrObjectGroup &group() { return group_; } @@ -5488,17 +4876,6 @@ class ICSetProp_NativeAddImpl : public ICSetProp_NativeAdd HandleShape newShape, HandleObjectGroup newGroup, uint32_t offset); public: - static inline ICSetProp_NativeAddImpl *New( - ICStubSpace *space, JitCode *code, HandleObjectGroup group, - const AutoShapeVector *shapes, HandleShape newShape, - HandleObjectGroup newGroup, uint32_t offset) - { - if (!code) - return nullptr; - return space->allocate >( - code, group, shapes, newShape, newGroup, offset); - } - void traceShapes(JSTracer *trc) { for (size_t i = 0; i < NumShapes; i++) MarkShape(trc, &shapes_[i], "baseline-setpropnativeadd-stub-shape"); @@ -5546,7 +4923,7 @@ class ICSetPropNativeAddCompiler : public ICStubCompiler RootedShape newShape(cx, obj_->lastProperty()); - return ICSetProp_NativeAddImpl::New( + return ICStub::New>( space, getStubCode(), oldGroup_, shapes, newShape, newGroup, offset_); } @@ -5569,14 +4946,6 @@ class ICSetProp_Unboxed : public ICUpdatedStub } public: - static inline ICSetProp_Unboxed *New(ICStubSpace *space, JitCode *code, - HandleObjectGroup group, uint32_t fieldOffset) - { - if (!code) - return nullptr; - return space->allocate(code, group, fieldOffset); - } - HeapPtrObjectGroup &group() { return group_; } @@ -5611,8 +4980,8 @@ class ICSetProp_Unboxed : public ICUpdatedStub {} ICUpdatedStub *getStub(ICStubSpace *space) { - ICUpdatedStub *stub = ICSetProp_Unboxed::New(space, getStubCode(), - group_, fieldOffset_); + ICUpdatedStub *stub = ICStub::New(space, getStubCode(), + group_, fieldOffset_); if (!stub || !stub->initUpdatingChain(cx, space)) return nullptr; return stub; @@ -5645,16 +5014,6 @@ class ICSetProp_TypedObject : public ICUpdatedStub } public: - static inline ICSetProp_TypedObject *New(ICStubSpace *space, JitCode *code, - HandleShape shape, HandleObjectGroup group, - uint32_t fieldOffset, bool isObjectReference) - { - if (!code) - return nullptr; - return space->allocate(code, shape, group, - fieldOffset, isObjectReference); - } - HeapPtrShape &shape() { return shape_; } @@ -5706,8 +5065,9 @@ class ICSetProp_TypedObject : public ICUpdatedStub bool isObjectReference = fieldDescr_->is() && fieldDescr_->as().type() == ReferenceTypeDescr::TYPE_OBJECT; - ICUpdatedStub *stub = ICSetProp_TypedObject::New(space, getStubCode(), shape_, group_, - fieldOffset_, isObjectReference); + ICUpdatedStub *stub = ICStub::New(space, getStubCode(), shape_, + group_, fieldOffset_, + isObjectReference); if (!stub || !stub->initUpdatingChain(cx, space)) return nullptr; return stub; @@ -5806,17 +5166,6 @@ class ICSetProp_CallScripted : public ICSetPropCallSetter {} public: - static inline ICSetProp_CallScripted *New(ICStubSpace *space, JitCode *code, - HandleShape shape, HandleObject holder, - HandleShape holderShape, HandleFunction setter, - uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, shape, holder, holderShape, setter, - pcOffset); - } - static ICSetProp_CallScripted *Clone(JSContext *cx, ICStubSpace *space, ICStub *, ICSetProp_CallScripted &other); @@ -5834,8 +5183,8 @@ class ICSetProp_CallScripted : public ICSetPropCallSetter ICStub *getStub(ICStubSpace *space) { RootedShape shape(cx, obj_->lastProperty()); RootedShape holderShape(cx, holder_->lastProperty()); - return ICSetProp_CallScripted::New(space, getStubCode(), shape, holder_, holderShape, - setter_, pcOffset_); + return ICStub::New(space, getStubCode(), shape, holder_, + holderShape, setter_, pcOffset_); } }; }; @@ -5853,17 +5202,6 @@ class ICSetProp_CallNative : public ICSetPropCallSetter {} public: - static inline ICSetProp_CallNative *New(ICStubSpace *space, JitCode *code, - HandleShape shape, HandleObject holder, - HandleShape holderShape, HandleFunction setter, - uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, shape, holder, holderShape, setter, - pcOffset); - } - static ICSetProp_CallNative *Clone(JSContext *cx, ICStubSpace *space, ICStub *, ICSetProp_CallNative &other); @@ -5881,8 +5219,8 @@ class ICSetProp_CallNative : public ICSetPropCallSetter ICStub *getStub(ICStubSpace *space) { RootedShape shape(cx, obj_->lastProperty()); RootedShape holderShape(cx, holder_->lastProperty()); - return ICSetProp_CallNative::New(space, getStubCode(), shape, holder_, holderShape, - setter_, pcOffset_); + return ICStub::New(space, getStubCode(), shape, holder_, + holderShape, setter_, pcOffset_); } }; }; @@ -5940,14 +5278,6 @@ class ICCall_Fallback : public ICMonitoredFallbackStub } public: - - static inline ICCall_Fallback *New(ICStubSpace *space, JitCode *code, bool isConstructing) - { - if (!code) - return nullptr; - return space->allocate(code, isConstructing); - } - bool isConstructing() const { return extra_ & CONSTRUCTING_FLAG; } @@ -5995,7 +5325,7 @@ class ICCall_Fallback : public ICMonitoredFallbackStub { } ICStub *getStub(ICStubSpace *space) { - ICCall_Fallback *stub = ICCall_Fallback::New(space, getStubCode(), isConstructing_); + ICCall_Fallback *stub = ICStub::New(space, getStubCode(), isConstructing_); if (!stub || !stub->initMonitoringChain(cx, space)) return nullptr; return stub; @@ -6022,17 +5352,6 @@ class ICCall_Scripted : public ICMonitoredStub uint32_t pcOffset); public: - static inline ICCall_Scripted *New( - ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - HandleFunction callee, HandleObject templateObject, - uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, - callee, templateObject, pcOffset); - } - static ICCall_Scripted *Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICCall_Scripted &other); @@ -6064,14 +5383,6 @@ class ICCall_AnyScripted : public ICMonitoredStub { } public: - static inline ICCall_AnyScripted *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, pcOffset); - } - static ICCall_AnyScripted *Clone(JSContext *, ICStubSpace *space, ICStub *firstMonitorStub, ICCall_AnyScripted &other); @@ -6122,11 +5433,11 @@ class ICCallScriptedCompiler : public ICCallStubCompiler { ICStub *getStub(ICStubSpace *space) { if (callee_) { - return ICCall_Scripted::New(space, getStubCode(), firstMonitorStub_, - callee_, templateObject_, - pcOffset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, + callee_, templateObject_, + pcOffset_); } - return ICCall_AnyScripted::New(space, getStubCode(), firstMonitorStub_, pcOffset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, pcOffset_); } }; @@ -6148,16 +5459,6 @@ class ICCall_Native : public ICMonitoredStub uint32_t pcOffset); public: - static inline ICCall_Native *New(ICStubSpace *space, JitCode *code, ICStub *firstMonitorStub, - HandleFunction callee, HandleObject templateObject, - uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, - callee, templateObject, pcOffset); - } - static ICCall_Native *Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICCall_Native &other); @@ -6211,8 +5512,8 @@ class ICCall_Native : public ICMonitoredStub { } ICStub *getStub(ICStubSpace *space) { - return ICCall_Native::New(space, getStubCode(), firstMonitorStub_, - callee_, templateObject_, pcOffset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, + callee_, templateObject_, pcOffset_); } }; }; @@ -6232,18 +5533,6 @@ class ICCall_ClassHook : public ICMonitoredStub uint32_t pcOffset); public: - static inline ICCall_ClassHook *New(ICStubSpace *space, - JitCode *code, ICStub *firstMonitorStub, - const Class *clasp, Native native, - HandleObject templateObject, - uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, - clasp, native, templateObject, pcOffset); - } - static ICCall_ClassHook *Clone(JSContext *cx, ICStubSpace *space, ICStub *firstMonitorStub, ICCall_ClassHook &other); @@ -6297,8 +5586,8 @@ class ICCall_ClassHook : public ICMonitoredStub { } ICStub *getStub(ICStubSpace *space) { - return ICCall_ClassHook::New(space, getStubCode(), firstMonitorStub_, - clasp_, native_, templateObject_, pcOffset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, + clasp_, native_, templateObject_, pcOffset_); } }; }; @@ -6321,14 +5610,6 @@ class ICCall_ScriptedApplyArray : public ICMonitoredStub {} public: - static inline ICCall_ScriptedApplyArray *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, pcOffset); - } - static ICCall_ScriptedApplyArray *Clone(JSContext *, ICStubSpace *space, ICStub *firstMonitorStub, ICCall_ScriptedApplyArray &other); @@ -6356,8 +5637,8 @@ class ICCall_ScriptedApplyArray : public ICMonitoredStub { } ICStub *getStub(ICStubSpace *space) { - return ICCall_ScriptedApplyArray::New(space, getStubCode(), firstMonitorStub_, - pcOffset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, + pcOffset_); } }; }; @@ -6375,14 +5656,6 @@ class ICCall_ScriptedApplyArguments : public ICMonitoredStub {} public: - static inline ICCall_ScriptedApplyArguments *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, pcOffset); - } - static ICCall_ScriptedApplyArguments *Clone(JSContext *, ICStubSpace *space, ICStub *firstMonitorStub, ICCall_ScriptedApplyArguments &other); @@ -6410,8 +5683,8 @@ class ICCall_ScriptedApplyArguments : public ICMonitoredStub { } ICStub *getStub(ICStubSpace *space) { - return ICCall_ScriptedApplyArguments::New(space, getStubCode(), firstMonitorStub_, - pcOffset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, + pcOffset_); } }; }; @@ -6430,14 +5703,6 @@ class ICCall_ScriptedFunCall : public ICMonitoredStub {} public: - static inline ICCall_ScriptedFunCall *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, uint32_t pcOffset) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, pcOffset); - } - static ICCall_ScriptedFunCall *Clone(JSContext *, ICStubSpace *space, ICStub *firstMonitorStub, ICCall_ScriptedFunCall &other); @@ -6464,8 +5729,8 @@ class ICCall_ScriptedFunCall : public ICMonitoredStub { } ICStub *getStub(ICStubSpace *space) { - return ICCall_ScriptedFunCall::New(space, getStubCode(), firstMonitorStub_, - pcOffset_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, + pcOffset_); } }; }; @@ -6488,16 +5753,6 @@ class ICCall_StringSplit : public ICMonitoredStub { } public: - static inline ICCall_StringSplit *New(ICStubSpace *space, JitCode *code, - ICStub *firstMonitorStub, uint32_t pcOffset, HandleString thisString, - HandleString argString, HandleArrayObject templateObject) - { - if (!code) - return nullptr; - return space->allocate(code, firstMonitorStub, pcOffset, thisString, - argString, templateObject); - } - static size_t offsetOfExpectedThis() { return offsetof(ICCall_StringSplit, expectedThis_); } @@ -6548,9 +5803,9 @@ class ICCall_StringSplit : public ICMonitoredStub { } ICStub *getStub(ICStubSpace *space) { - return ICCall_StringSplit::New(space, getStubCode(), firstMonitorStub_, - pcOffset_, expectedThis_, expectedArg_, - templateObject_); + return ICStub::New(space, getStubCode(), firstMonitorStub_, + pcOffset_, expectedThis_, expectedArg_, + templateObject_); } }; }; @@ -6565,12 +5820,6 @@ class ICCall_IsSuspendedStarGenerator : public ICStub {} public: - static inline ICCall_IsSuspendedStarGenerator *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -6580,7 +5829,7 @@ class ICCall_IsSuspendedStarGenerator : public ICStub : ICStubCompiler(cx, ICStub::Call_IsSuspendedStarGenerator) {} ICStub *getStub(ICStubSpace *space) { - return ICCall_IsSuspendedStarGenerator::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -6604,13 +5853,6 @@ class ICTableSwitch : public ICStub {} public: - static inline ICTableSwitch *New(ICStubSpace *space, JitCode *code, void **table, - int32_t min, int32_t length, void *defaultTarget) { - if (!code) - return nullptr; - return space->allocate(code, table, min, length, defaultTarget); - } - void fixupJumpTable(JSScript *script, BaselineScript *baseline); class Compiler : public ICStubCompiler { @@ -6637,12 +5879,6 @@ class ICIteratorNew_Fallback : public ICFallbackStub { } public: - static inline ICIteratorNew_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -6653,7 +5889,7 @@ class ICIteratorNew_Fallback : public ICFallbackStub { } ICStub *getStub(ICStubSpace *space) { - return ICIteratorNew_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -6668,12 +5904,6 @@ class ICIteratorMore_Fallback : public ICFallbackStub { } public: - static inline ICIteratorMore_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - void setHasNonStringResult() { extra_ = 1; } @@ -6692,7 +5922,7 @@ class ICIteratorMore_Fallback : public ICFallbackStub { } ICStub *getStub(ICStubSpace *space) { - return ICIteratorMore_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -6707,12 +5937,6 @@ class ICIteratorMore_Native : public ICStub { } public: - static inline ICIteratorMore_Native *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -6723,7 +5947,7 @@ class ICIteratorMore_Native : public ICStub { } ICStub *getStub(ICStubSpace *space) { - return ICIteratorMore_Native::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -6738,12 +5962,6 @@ class ICIteratorClose_Fallback : public ICFallbackStub { } public: - static inline ICIteratorClose_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -6754,7 +5972,7 @@ class ICIteratorClose_Fallback : public ICFallbackStub { } ICStub *getStub(ICStubSpace *space) { - return ICIteratorClose_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -6774,12 +5992,6 @@ class ICInstanceOf_Fallback : public ICFallbackStub public: static const uint32_t MAX_OPTIMIZED_STUBS = 4; - static inline ICInstanceOf_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - void noteUnoptimizableAccess() { extra_ |= UNOPTIMIZABLE_ACCESS_BIT; } @@ -6797,7 +6009,7 @@ class ICInstanceOf_Fallback : public ICFallbackStub { } ICStub *getStub(ICStubSpace *space) { - return ICInstanceOf_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -6813,14 +6025,6 @@ class ICInstanceOf_Function : public ICStub ICInstanceOf_Function(JitCode *stubCode, Shape *shape, JSObject *prototypeObj, uint32_t slot); public: - static inline ICInstanceOf_Function *New(ICStubSpace *space, JitCode *code, Shape *shape, - JSObject *prototypeObj, uint32_t slot) - { - if (!code) - return nullptr; - return space->allocate(code, shape, prototypeObj, slot); - } - HeapPtrShape &shape() { return shape_; } @@ -6857,7 +6061,7 @@ class ICInstanceOf_Function : public ICStub {} ICStub *getStub(ICStubSpace *space) { - return ICInstanceOf_Function::New(space, getStubCode(), shape_, prototypeObj_, slot_); + return ICStub::New(space, getStubCode(), shape_, prototypeObj_, slot_); } }; }; @@ -6874,12 +6078,6 @@ class ICTypeOf_Fallback : public ICFallbackStub { } public: - static inline ICTypeOf_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -6890,7 +6088,7 @@ class ICTypeOf_Fallback : public ICFallbackStub { } ICStub *getStub(ICStubSpace *space) { - return ICTypeOf_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -6907,12 +6105,6 @@ class ICTypeOf_Typed : public ICFallbackStub } public: - static inline ICTypeOf_Typed *New(ICStubSpace *space, JitCode *code, JSType type) { - if (!code) - return nullptr; - return space->allocate(code, type); - } - JSType type() const { return JSType(extra_); } @@ -6935,7 +6127,7 @@ class ICTypeOf_Typed : public ICFallbackStub { } ICStub *getStub(ICStubSpace *space) { - return ICTypeOf_Typed::New(space, getStubCode(), type_); + return ICStub::New(space, getStubCode(), type_); } }; }; @@ -6953,13 +6145,6 @@ class ICRest_Fallback : public ICFallbackStub public: static const uint32_t MAX_OPTIMIZED_STUBS = 8; - static inline ICRest_Fallback *New(ICStubSpace *space, JitCode *code, - ArrayObject *templateObject) { - if (!code) - return nullptr; - return space->allocate(code, templateObject); - } - HeapPtrArrayObject &templateObject() { return templateObject_; } @@ -6976,7 +6161,7 @@ class ICRest_Fallback : public ICFallbackStub { } ICStub *getStub(ICStubSpace *space) { - return ICRest_Fallback::New(space, getStubCode(), templateObject); + return ICStub::New(space, getStubCode(), templateObject); } }; }; @@ -6993,12 +6178,6 @@ class ICRetSub_Fallback : public ICFallbackStub public: static const uint32_t MAX_OPTIMIZED_STUBS = 8; - static inline ICRetSub_Fallback *New(ICStubSpace *space, JitCode *code) { - if (!code) - return nullptr; - return space->allocate(code); - } - class Compiler : public ICStubCompiler { protected: bool generateStubCode(MacroAssembler &masm); @@ -7009,7 +6188,7 @@ class ICRetSub_Fallback : public ICFallbackStub { } ICStub *getStub(ICStubSpace *space) { - return ICRetSub_Fallback::New(space, getStubCode()); + return ICStub::New(space, getStubCode()); } }; }; @@ -7031,13 +6210,6 @@ class ICRetSub_Resume : public ICStub { } public: - static ICRetSub_Resume *New(ICStubSpace *space, JitCode *code, uint32_t pcOffset, - uint8_t *addr) { - if (!code) - return nullptr; - return space->allocate(code, pcOffset, addr); - } - static size_t offsetOfPCOffset() { return offsetof(ICRetSub_Resume, pcOffset_); } @@ -7059,7 +6231,7 @@ class ICRetSub_Resume : public ICStub { } ICStub *getStub(ICStubSpace *space) { - return ICRetSub_Resume::New(space, getStubCode(), pcOffset_, addr_); + return ICStub::New(space, getStubCode(), pcOffset_, addr_); } }; }; From 993adae83fda88db275e0431b88b36789c797ad2 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Wed, 18 Feb 2015 12:48:39 +0100 Subject: [PATCH 069/115] Bug 1133859: Allow shared array views as SIMD.load/store arguments; r=lth --HG-- extra : rebase_source : 491c6d6fe54e7db8bd5460578fc1732fe7d2fdf2 --- js/src/builtin/SIMD.cpp | 19 ++++++------ js/src/tests/ecma_7/SIMD/load.js | 49 +++++++++++++++++++++++++++++-- js/src/tests/ecma_7/SIMD/store.js | 41 ++++++++++++++++++++++++++ js/src/vm/TypedArrayCommon.h | 8 +++++ 4 files changed, 106 insertions(+), 11 deletions(-) diff --git a/js/src/builtin/SIMD.cpp b/js/src/builtin/SIMD.cpp index 550c317f19e2..2b7114034808 100644 --- a/js/src/builtin/SIMD.cpp +++ b/js/src/builtin/SIMD.cpp @@ -1017,23 +1017,24 @@ Select(JSContext *cx, unsigned argc, Value *vp) template static bool TypedArrayFromArgs(JSContext *cx, const CallArgs &args, - MutableHandle typedArray, int32_t *byteStart) + MutableHandleObject typedArray, int32_t *byteStart) { if (!args[0].isObject()) return ErrorBadArgs(cx); JSObject &argobj = args[0].toObject(); - if (!argobj.is()) + if (!IsAnyTypedArray(&argobj)) return ErrorBadArgs(cx); - typedArray.set(&argobj.as()); + typedArray.set(&argobj); int32_t index; if (!ToInt32(cx, args[1], &index)) return false; - *byteStart = index * typedArray->bytesPerElement(); - if (*byteStart < 0 || (uint32_t(*byteStart) + NumElem * sizeof(VElem)) > typedArray->byteLength()) + *byteStart = index * AnyTypedArrayBytesPerElement(typedArray); + if (*byteStart < 0 || + (uint32_t(*byteStart) + NumElem * sizeof(VElem)) > AnyTypedArrayByteLength(typedArray)) { // Keep in sync with AsmJS OnOutOfBounds function. JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_INDEX); @@ -1054,7 +1055,7 @@ Load(JSContext *cx, unsigned argc, Value *vp) return ErrorBadArgs(cx); int32_t byteStart; - Rooted typedArray(cx); + RootedObject typedArray(cx); if (!TypedArrayFromArgs(cx, args, &typedArray, &byteStart)) return false; @@ -1064,7 +1065,7 @@ Load(JSContext *cx, unsigned argc, Value *vp) if (!result) return false; - Elem *src = reinterpret_cast(static_cast(typedArray->viewData()) + byteStart); + Elem *src = reinterpret_cast(static_cast(AnyTypedArrayViewData(typedArray)) + byteStart); Elem *dst = reinterpret_cast(result->typedMem()); memcpy(dst, src, sizeof(Elem) * NumElem); @@ -1083,7 +1084,7 @@ Store(JSContext *cx, unsigned argc, Value *vp) return ErrorBadArgs(cx); int32_t byteStart; - Rooted typedArray(cx); + RootedObject typedArray(cx); if (!TypedArrayFromArgs(cx, args, &typedArray, &byteStart)) return false; @@ -1091,7 +1092,7 @@ Store(JSContext *cx, unsigned argc, Value *vp) return ErrorBadArgs(cx); Elem *src = TypedObjectMemory(args[2]); - Elem *dst = reinterpret_cast(static_cast(typedArray->viewData()) + byteStart); + Elem *dst = reinterpret_cast(static_cast(AnyTypedArrayViewData(typedArray)) + byteStart); memcpy(dst, src, sizeof(Elem) * NumElem); args.rval().setObject(args[2].toObject()); diff --git a/js/src/tests/ecma_7/SIMD/load.js b/js/src/tests/ecma_7/SIMD/load.js index 706bc4b4212d..00fe77e86aad 100644 --- a/js/src/tests/ecma_7/SIMD/load.js +++ b/js/src/tests/ecma_7/SIMD/load.js @@ -11,9 +11,15 @@ const SIZE_64_ARRAY = 8; const SIZE_BYTES = SIZE_32_ARRAY * 4; -function MakeComparator(kind, arr) { +function IsSharedTypedArray(arr) { + return arr && arr.buffer && arr.buffer instanceof SharedArrayBuffer; +} + +function MakeComparator(kind, arr, shared) { var bpe = arr.BYTES_PER_ELEMENT; - var uint8 = (bpe != 1) ? new Uint8Array(arr.buffer) : arr; + var uint8 = (bpe != 1) ? (IsSharedTypedArray(arr) ? new SharedUint8Array(arr.buffer) + : new Uint8Array(arr.buffer)) + : arr; // Size in bytes of a single element in the SIMD vector. var sizeOfLaneElem; @@ -163,9 +169,48 @@ function testLoad(kind, TA) { assertThrowsInstanceOf(() => SIMD[kind].load(TA, obj), TypeError); } +function testSharedArrayBufferCompat() { + if (!this.SharedArrayBuffer || !this.SharedFloat32Array || !this.Atomics) + return; + + var TA = new SharedFloat32Array(16); + for (var i = 0; i < 16; i++) + TA[i] = i + 1; + + for (var ta of [ + new SharedUint8Array(TA.buffer), + new SharedInt8Array(TA.buffer), + new SharedUint16Array(TA.buffer), + new SharedInt16Array(TA.buffer), + new SharedUint32Array(TA.buffer), + new SharedInt32Array(TA.buffer), + new SharedFloat32Array(TA.buffer), + new SharedFloat64Array(TA.buffer) + ]) + { + for (var kind of ['int32x4', 'float32x4', 'float64x2']) { + var comp = MakeComparator(kind, ta); + comp.load(0); + comp.loadX(0); + comp.loadXY(0); + comp.loadXYZ(0); + + comp.load(3); + comp.loadX(3); + comp.loadXY(3); + comp.loadXYZ(3); + } + + assertThrowsInstanceOf(() => SIMD.int32x4.load(ta, 1024), RangeError); + assertThrowsInstanceOf(() => SIMD.float32x4.load(ta, 1024), RangeError); + assertThrowsInstanceOf(() => SIMD.float64x2.load(ta, 1024), RangeError); + } +} + testLoad('float32x4', new Float32Array(SIZE_32_ARRAY)); testLoad('float64x2', new Float64Array(SIZE_64_ARRAY)); testLoad('int32x4', new Int32Array(SIZE_32_ARRAY)); +testSharedArrayBufferCompat(); if (typeof reportCompare === "function") reportCompare(true, true); diff --git a/js/src/tests/ecma_7/SIMD/store.js b/js/src/tests/ecma_7/SIMD/store.js index 839cf8df5712..5d588e2e9098 100644 --- a/js/src/tests/ecma_7/SIMD/store.js +++ b/js/src/tests/ecma_7/SIMD/store.js @@ -103,9 +103,50 @@ function testStoreFloat64x2() { assertThrowsInstanceOf(() => SIMD.float32x4.store(F64, 0, v), TypeError); } +function testSharedArrayBufferCompat() { + if (!this.SharedArrayBuffer || !this.SharedFloat32Array || !this.Atomics) + return; + + var I32 = new SharedInt32Array(16); + var TA = I32; + + var F32 = new SharedFloat32Array(TA.buffer); + var F64 = new SharedFloat64Array(TA.buffer); + + var int32x4 = SIMD.int32x4(1, 2, 3, 4); + var float32x4 = SIMD.float32x4(1, 2, 3, 4); + var float64x2 = SIMD.float64x2(1, 2); + + for (var ta of [ + new SharedUint8Array(TA.buffer), + new SharedInt8Array(TA.buffer), + new SharedUint16Array(TA.buffer), + new SharedInt16Array(TA.buffer), + new SharedUint32Array(TA.buffer), + new SharedInt32Array(TA.buffer), + new SharedFloat32Array(TA.buffer), + new SharedFloat64Array(TA.buffer) + ]) + { + SIMD.int32x4.store(ta, 0, int32x4); + for (var i = 0; i < 4; i++) assertEq(I32[i], [1, 2, 3, 4][i]); + + SIMD.float32x4.store(ta, 0, float32x4); + for (var i = 0; i < 4; i++) assertEq(F32[i], [1, 2, 3, 4][i]); + + SIMD.float64x2.store(ta, 0, float64x2); + for (var i = 0; i < 2; i++) assertEq(F64[i], [1, 2][i]); + + assertThrowsInstanceOf(() => SIMD.int32x4.store(ta, 1024, int32x4), RangeError); + assertThrowsInstanceOf(() => SIMD.float32x4.store(ta, 1024, float32x4), RangeError); + assertThrowsInstanceOf(() => SIMD.float64x2.store(ta, 1024, float64x2), RangeError); + } +} + testStoreInt32x4(); testStoreFloat32x4(); testStoreFloat64x2(); +testSharedArrayBufferCompat(); if (typeof reportCompare === "function") reportCompare(true, true); diff --git a/js/src/vm/TypedArrayCommon.h b/js/src/vm/TypedArrayCommon.h index 66640dd2fb49..573409dbf219 100644 --- a/js/src/vm/TypedArrayCommon.h +++ b/js/src/vm/TypedArrayCommon.h @@ -113,6 +113,14 @@ AnyTypedArrayViewData(const JSObject *obj) return obj->as().viewData(); } +inline uint32_t +AnyTypedArrayBytesPerElement(const JSObject *obj) +{ + if (obj->is()) + return obj->as().bytesPerElement(); + return obj->as().bytesPerElement(); +} + inline uint32_t AnyTypedArrayByteLength(const JSObject *obj) { From b6225617b0ab3af449b8ddff8ca1d0f9d5b1c40f Mon Sep 17 00:00:00 2001 From: Joe Steele Date: Thu, 19 Feb 2015 07:10:26 +1300 Subject: [PATCH 070/115] Bug 1131798 - Fix handling of CPU sub-type and rebasing WITHOUT requiring Python 3.3. r=ted --- python/eme/gen-eme-voucher.py | 346 ++++++++++++++++++++++++++-------- 1 file changed, 268 insertions(+), 78 deletions(-) diff --git a/python/eme/gen-eme-voucher.py b/python/eme/gen-eme-voucher.py index 24d1cb8b98d5..40da5d11308e 100644 --- a/python/eme/gen-eme-voucher.py +++ b/python/eme/gen-eme-voucher.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python2.7 +# # Copyright 2014 Adobe Systems Incorporated. All Rights Reserved. # # Adobe permits you to use, modify, and distribute this file in accordance @@ -6,17 +7,18 @@ # a copy of the MPL was not distributed with this file, You can obtain one # at http://mozilla.org/MPL/2.0/. # -# Create perforce changelist of modules from FTP server +# Creates an Adobe Access signed voucher for any executable +# Notes: This is currently python2.7 due to mozilla build system requirements -import io, argparse,pyasn1, bitstring -from pyasn1.codec.der import encoder, decoder +import argparse, bitstring, pprint, hashlib, os, subprocess, sys, tempfile +from pyasn1.codec.der import encoder as der_encoder from pyasn1.type import univ, namedtype, namedval, constraint -import hashlib + # CodeSectionDigest ::= SEQUENCE { -# offset INTEGER -- section's file offset in the signed binary -# digestAlgorithm OBJECT IDENTIFIER -- algorithm identifier for the hash value below. For now only supports SHA256. -# digestValue OCTET STRING -- hash value of the TEXT segment. +# offset INTEGER -- section's file offset in the signed binary +# digestAlgorithm OBJECT IDENTIFIER -- algorithm identifier for the hash value below. For now only supports SHA256. +# digestValue OCTET STRING -- hash value of the TEXT segment. # } class CodeSectionDigest(univ.Sequence): componentType = namedtype.NamedTypes( @@ -24,6 +26,7 @@ class CodeSectionDigest(univ.Sequence): namedtype.NamedType('digestAlgorithm', univ.ObjectIdentifier()), namedtype.NamedType('digest', univ.OctetString())) + # CodeSegmentDigest ::= SEQUENCE { # offset INTEGER -- TEXT segment's file offset in the signed binary # codeSectionDigests SET OF CodeSectionDigests @@ -32,20 +35,22 @@ class CodeSectionDigest(univ.Sequence): class SetOfCodeSectionDigest(univ.SetOf): componentType = CodeSectionDigest() + class CodeSegmentDigest(univ.Sequence): componentType = namedtype.NamedTypes( namedtype.NamedType('offset', univ.Integer()), namedtype.NamedType('codeSectionDigests', SetOfCodeSectionDigest())) + # ArchitectureDigest ::= SEQUENCE { # cpuType ENUMERATED CpuType # cpuSubType ENUMERATED CpuSubType # CodeSegmentDigests SET OF CodeSegmentDigests # } - class SetOfCodeSegmentDigest(univ.SetOf): componentType = CodeSegmentDigest() + class CPUType(univ.Enumerated): namedValues = namedval.NamedValues( ('IMAGE_FILE_MACHINE_I386', 0x14c), @@ -55,34 +60,46 @@ class CPUType(univ.Enumerated): constraint.SingleValueConstraint(0x14c, 0x8664) +class CPUSubType(univ.Enumerated): + namedValues = namedval.NamedValues( + ('IMAGE_UNUSED', 0x0), + ) + subtypeSpec = univ.Enumerated.subtypeSpec + \ + constraint.SingleValueConstraint(0) + + class ArchitectureDigest(univ.Sequence): componentType = namedtype.NamedTypes( namedtype.NamedType('cpuType', CPUType()), - namedtype.NamedType('cpuSubType', univ.Integer()), + namedtype.NamedType('cpuSubType', CPUSubType()), namedtype.NamedType('CodeSegmentDigests', SetOfCodeSegmentDigest()) ) -# ApplicationDigest ::= SEQUENCE { -# version INTEGER -# digests SET OF ArchitectureDigest -# } + +# ApplicationDigest ::= SEQUENCE { +# version INTEGER +# digests SET OF ArchitectureDigest +# } class SetOfArchitectureDigest(univ.SetOf): componentType = ArchitectureDigest() + class ApplicationDigest(univ.Sequence): componentType = namedtype.NamedTypes( namedtype.NamedType('version', univ.Integer()), namedtype.NamedType('digests', SetOfArchitectureDigest()) ) -def meetsRequirements(items, requirements): + +def meets_requirements(items, requirements): for r in requirements: for n, v in r.items(): if n not in items or items[n] != v: return False return True + # return total number of bytes read from items_in excluding leaves -def parseItems(stream, items_in, items_out): +def parse_items(stream, items_in, items_out): bits_read = 0 total_bits_read = 0 @@ -102,7 +119,7 @@ def parseItems(stream, items_in, items_out): requirements = list(filter(lambda x: isinstance(x, dict), item[2])) sub_items = list(filter(lambda x: isinstance(x, tuple), item[2])) - if not meetsRequirements(items_out, requirements): continue + if not meets_requirements(items_out, requirements): continue # has sub-items based on length items_out[name] = stream.read(t) @@ -113,7 +130,7 @@ def parseItems(stream, items_in, items_out): bit_length = items_out[name] * 8 if bit_length > 0: - sub_read, sub_total_read = parseItems(stream, sub_items, items_out) + sub_read, sub_total_read = parse_items(stream, sub_items, items_out) bit_length -= sub_read total_bits_read += sub_total_read @@ -127,6 +144,7 @@ def parseItems(stream, items_in, items_out): return bits_read, total_bits_read +# TODO: perhaps switch to pefile module when it officially supports python3 class SectionHeader: def __init__(self, stream): items = [ @@ -141,15 +159,115 @@ class SectionHeader: ('NumberOfLineNumbers', 'uintle:16'), ('Characteristics', 'uintle:32') ] - self.items = {} - _, self.bits_read = parseItems(stream, items, self.items) + self.items = dict() + self.relocs = dict() + + _, self.bits_read = parse_items(stream, items, self.items) self.sectionName = self.items['Name'].decode('utf-8') self.offset = self.items['PointerToRawData'] +COFF_DATA_DIRECTORY_TYPES = [ + "Export Table", + "Import Table", + "Resource Table", + "Exception Table", + "Certificate Tble", + "Base Relocation Table", + "Debug", + "Architecture", + "Global Ptr", + "TLS Table", + "Load Config Table", + "Bound Import", + "IAT", + "Delay Import Descriptor", + "CLR Runtime Header", + "Reserved", +] + + +def chained_safe_get(obj, names, default=None): + if obj is None: return default + + for n in names: + if n in obj: + obj = obj[n] + else: + return default + + return obj + + +class OptionalHeader: + def __init__(self, stream, size): + self.items = {} + items = [] + + if size: + items += [ + ('Magic', 'uintle:16'), + ('MajorLinkerVersion', 'uintle:8'), + ('MinorLinkerVersion', 'uintle:8'), + ('SizeOfCode', 'uintle:32'), + ('SizeOfInitializedData', 'uintle:32'), + ('SizeOfUninitializedData', 'uintle:32'), + ('AddressOfEntryPoint', 'uintle:32'), + ('BaseOfCode', 'uintle:32'), + ] + + _, self.bits_read = parse_items(stream, items, self.items) + + items = [] + if self.items['Magic'] == 0x10b: # PE32 + items += [('BaseOfData', 'uintle:32')] + + address_size = 'uintle:64' if self.items['Magic'] == 0x20b else 'uintle:32' + + items += [ + ('ImageBase', address_size), + ('SectionAlignment', 'uintle:32'), + ('FileAlignment', 'uintle:32'), + ('MajorOperatingSystemVersion', 'uintle:16'), + ('MinorOperatingSystemVersion', 'uintle:16'), + ('MajorImageVersion', 'uintle:16'), + ('MinorImageVersion', 'uintle:16'), + ('MajorSubsystemVersion', 'uintle:16'), + ('MinorSubsystemVersion', 'uintle:16'), + ('Win32VersionValue', 'uintle:32'), + ('SizeOfImage', 'uintle:32'), + ('SizeOfHeaders', 'uintle:32'), + ('CheckSum', 'uintle:32'), + ('Subsystem', 'uintle:16'), + ('DllCharacteristics', 'uintle:16'), + ('SizeOfStackReserve', address_size), + ('SizeOfStackCommit', address_size), + ('SizeOfHeapReserve', address_size), + ('SizeOfHeapCommit', address_size), + ('LoaderFlags', 'uintle:32'), + ('NumberOfRvaAndSizes', 'uintle:32'), + ] + + if size > 28: + _, bits_read = parse_items(stream, items, self.items) + self.bits_read += bits_read + + if 'NumberOfRvaAndSizes' in self.items: + index = 0 + self.items['Data Directories'] = dict() + while self.bits_read / 8 < size: + d = self.items['Data Directories'][COFF_DATA_DIRECTORY_TYPES[index]] = dict() + + _, bits_read = parse_items(stream, [('VirtualAddress', 'uintle:32'), ('Size', 'uintle:32')], d) + self.bits_read += bits_read + index += 1 + class COFFFileHeader: def __init__(self, stream): + self.items = {} + self.section_headers = [] + items = [ ('Machine', 'uintle:16'), ('NumberOfSections', 'uintle:16'), @@ -159,106 +277,178 @@ class COFFFileHeader: ('SizeOfOptionalHeader', 'uintle:16'), ('Characteristics', 'uintle:16') ] - self.items = {} - _, self.bits_read = parseItems(stream, items, self.items) + _, self.bits_read = parse_items(stream, items, self.items) - #skip over optional header. - if self.items['SizeOfOptionalHeader'] > 0: - stream.read(self.items['SizeOfOptionalHeader'] * 8) - self.bits_read += self.items['SizeOfOptionalHeader'] * 8 + self.OptionalHeader = OptionalHeader(stream, self.items['SizeOfOptionalHeader']) + self.bits_read += self.OptionalHeader.bits_read - #start reading section headers - numberOfSections = self.items['NumberOfSections'] - self.codeSectionHeaders = [] + # start reading section headers + num_sections = self.items['NumberOfSections'] - while numberOfSections > 0 : - sectionHeader = SectionHeader(stream) - if (sectionHeader.items['Characteristics'] & 0x20000000) == 0x20000000: - self.codeSectionHeaders.append(sectionHeader) - numberOfSections -= 1 + while num_sections > 0 : + section_header = SectionHeader(stream) + self.bits_read += section_header.bits_read + self.section_headers.append(section_header) + num_sections -= 1 - self.codeSectionHeaders.sort(key=lambda header: header.offset) + self.section_headers.sort(key=lambda header: header.offset) + + # Read Relocations + self.process_relocs(stream) + + def process_relocs(self, stream): + reloc_table = chained_safe_get(self.OptionalHeader.items, ['Data Directories', 'Base Relocation Table']) + if reloc_table is None: return + + orig_pos = stream.bitpos + _, stream.bytepos = self.get_rva_section(reloc_table['VirtualAddress']) + end_pos = stream.bitpos + reloc_table['Size'] * 8 + + while stream.bitpos < end_pos: + page_rva = stream.read('uintle:32') + block_size = stream.read('uintle:32') + + for i in range(0, int((block_size - 8) / 2)): + data = stream.read('uintle:16') + typ = data >> 12 + offset = data & 0xFFF + + if offset == 0 and i > 0: continue + + assert(typ == 3) + + cur_pos = stream.bitpos + sh, value_bytepos = self.get_rva_section(page_rva + offset) + stream.bytepos = value_bytepos + value = stream.read('uintle:32') + + # remove BaseAddress + value -= self.OptionalHeader.items['ImageBase'] + + stream.overwrite(bitstring.BitArray(uint=value, length=4 * 8), pos=value_bytepos * 8) + stream.pos = cur_pos + + stream.bitpos = orig_pos + + def get_rva_section(self, rva): + for sh in self.section_headers: + if rva < sh.items['VirtualAddress'] or rva >= sh.items['VirtualAddress'] + sh.items['VirtualSize']: + continue + + file_pointer = rva - sh.items['VirtualAddress'] + sh.items['PointerToRawData'] + return sh, file_pointer + + raise Exception('Could not match RVA to section') +def create_temp_file(suffix=""): + fd, path = tempfile.mkstemp(suffix=suffix) + os.close(fd) + return path + +# TIPS: +# How to convert PFX to PEM: openssl pkcs12 -in build/certificates/testPKI/IV.pfx -out build/certificates/testPKI/IV.cert.pem def main(): - parser = argparse.ArgumentParser(description='PE/COFF Parser.') + parser = argparse.ArgumentParser(description='PE/COFF Signer') parser.add_argument('-input', required=True, help="File to parse.") parser.add_argument('-output', required=True, help="File to write to.") + parser.add_argument('-openssl_path',help="Path to OpenSSL to create signed voucher") + parser.add_argument('-signer_cert',help="Path to certificate to use to sign voucher. Must be PEM encoded.") parser.add_argument('-verbose', action='store_true', help="Verbose output.") app_args = parser.parse_args() - stream = bitstring.ConstBitStream(filename=app_args.input) + # to simplify relocation handling we use a mutable BitStream so we can remove + # the BaseAddress from each relocation + stream = bitstring.BitStream(filename=app_args.input) + # find the COFF header. # skip forward past the MSDOS stub header to 0x3c. - stream.bytepos = 0x3c # read 4 bytes, this is the file offset of the PE signature. - peSignatureOffset = stream.read('uintle:32') - stream.bytepos = peSignatureOffset + pe_sig_offset = stream.read('uintle:32') + stream.bytepos = pe_sig_offset - #read 4 bytes, make sure it's a PE signature. + # read 4 bytes, make sure it's a PE signature. signature = stream.read('uintle:32') - if signature != 0x00004550 : - return + if signature != 0x00004550: + raise Exception("Invalid File") + # after signature is the actual COFF file header. + coff_header = COFFFileHeader(stream) - archDigest = ArchitectureDigest() + arch_digest = ArchitectureDigest() + if coff_header.items['Machine'] == 0x14c: + arch_digest.setComponentByName('cpuType', CPUType('IMAGE_FILE_MACHINE_I386')) + elif coff_header.items['Machine'] == 0x8664: + arch_digest.setComponentByName('cpuType', CPUType('IMAGE_FILE_MACHINE_AMD64')) - codeSegmentDigests = SetOfCodeSegmentDigest() - codeSegmentIdx = 0 + arch_digest.setComponentByName('cpuSubType', CPUSubType('IMAGE_UNUSED')) - #after signature is the actual COFF file header. - coffFileHeader = COFFFileHeader(stream) + text_section_headers = list(filter(lambda x: (x.items['Characteristics'] & 0x20000000) == 0x20000000, coff_header.section_headers)) - if coffFileHeader.items['Machine'] == 0x14c: - archDigest.setComponentByName('cpuType', CPUType('IMAGE_FILE_MACHINE_I386')) - elif coffFileHeader.items['Machine'] == 0x8664: - archDigest.setComponentByName('cpuType', CPUType('IMAGE_FILE_MACHINE_AMD64')) - - archDigest.setComponentByName('cpuSubType', 0) - - - for codeSectionHeader in coffFileHeader.codeSectionHeaders: - stream.bytepos = codeSectionHeader.offset - codeSectionBytes = stream.read('bytes:'+ str(codeSectionHeader.items['SizeOfRawData'])) - if codeSectionHeader.items['SizeOfRawData'] < codeSectionHeader.items['VirtualSize']: - #zero pad up to virtualSize - codeSectionBytes += "\0" * (codeSectionHeader.items['VirtualSize']-codeSectionHeader.items['SizeOfRawData']) + code_segment_digests = SetOfCodeSegmentDigest() + code_segment_idx = 0 + for code_sect_header in text_section_headers: + stream.bytepos = code_sect_header.offset + code_sect_bytes = stream.read('bytes:' + str(code_sect_header.items['VirtualSize'])) digester = hashlib.sha256() - digester.update(codeSectionBytes) + digester.update(code_sect_bytes) digest = digester.digest() - codeSectionDigest = CodeSectionDigest() - codeSectionDigest.setComponentByName('offset', codeSectionHeader.offset) - codeSectionDigest.setComponentByName('digestAlgorithm', univ.ObjectIdentifier('2.16.840.1.101.3.4.2.1')) - codeSectionDigest.setComponentByName('digest', univ.OctetString(digest)) + # with open('segment_' + str(code_sect_header.offset) + ".bin", 'wb') as f: + # f.write(code_sect_bytes) - setOfDigest = SetOfCodeSectionDigest() - setOfDigest.setComponentByPosition(0, codeSectionDigest) + code_section_digest = CodeSectionDigest() + code_section_digest.setComponentByName('offset', code_sect_header.offset) + code_section_digest.setComponentByName('digestAlgorithm', univ.ObjectIdentifier('2.16.840.1.101.3.4.2.1')) + code_section_digest.setComponentByName('digest', univ.OctetString(digest)) + + set_of_digest = SetOfCodeSectionDigest() + set_of_digest.setComponentByPosition(0, code_section_digest) codeSegmentDigest = CodeSegmentDigest() - codeSegmentDigest.setComponentByName('offset', codeSectionHeader.offset) - codeSegmentDigest.setComponentByName('codeSectionDigests', setOfDigest) + codeSegmentDigest.setComponentByName('offset', code_sect_header.offset) + codeSegmentDigest.setComponentByName('codeSectionDigests', set_of_digest) - codeSegmentDigests.setComponentByPosition(codeSegmentIdx, codeSegmentDigest) - codeSegmentIdx += 1 + code_segment_digests.setComponentByPosition(code_segment_idx, codeSegmentDigest) + code_segment_idx += 1 - archDigest.setComponentByName('CodeSegmentDigests', codeSegmentDigests) + arch_digest.setComponentByName('CodeSegmentDigests', code_segment_digests) setOfArchDigests = SetOfArchitectureDigest() - setOfArchDigests.setComponentByPosition(0, archDigest) + setOfArchDigests.setComponentByPosition(0, arch_digest) appDigest = ApplicationDigest() appDigest.setComponentByName('version', 1) appDigest.setComponentByName('digests', setOfArchDigests) - binaryDigest = encoder.encode(appDigest) + binaryDigest = der_encoder.encode(appDigest) - outFile = open(app_args.output, 'wb') - outFile.write(binaryDigest) + with open(app_args.output, 'wb') as f: + f.write(binaryDigest) + + # sign with openssl if specified + if app_args.openssl_path is not None: + assert app_args.signer_cert is not None + + out_base, out_ext = os.path.splitext(app_args.output) + signed_path = out_base + ".signed" + out_ext + + # http://stackoverflow.com/questions/12507277/how-to-fix-unable-to-write-random-state-in-openssl + temp_file = None + if sys.platform == "win32" and "RANDFILE" not in os.environ: + temp_file = create_temp_file() + os.environ["RANDFILE"] = temp_file + + try: + subprocess.check_call([app_args.openssl_path, "cms", "-sign", "-nodetach", "-md", "sha256", "-binary", "-in", app_args.output, "-outform", "der", "-out", signed_path, "-signer", app_args.signer_cert], ) + finally: + if temp_file is not None: + del os.environ["RANDFILE"] + os.unlink(temp_file) if __name__ == '__main__': main() From 22671df9312eabfbd74a105280c786401c7ad10e Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Thu, 19 Feb 2015 03:15:31 +0900 Subject: [PATCH 071/115] Bug 1018628 - Lookup definition node for identifierName in default value in destructuring. r=jorendorff --- js/src/frontend/Parser.cpp | 3 +++ .../arguments/destructuring-default-value-scope.js | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 js/src/jit-test/tests/arguments/destructuring-default-value-scope.js diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 738c7c6b1b23..b134d672ca0e 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -6292,7 +6292,10 @@ Parser::assignExpr(InvokedPrediction invoked) if (!checkAndMarkAsAssignmentLhs(lhs, flavor)) return null(); + bool saved = pc->inDeclDestructuring; + pc->inDeclDestructuring = false; Node rhs = assignExpr(); + pc->inDeclDestructuring = saved; if (!rhs) return null(); diff --git a/js/src/jit-test/tests/arguments/destructuring-default-value-scope.js b/js/src/jit-test/tests/arguments/destructuring-default-value-scope.js new file mode 100644 index 000000000000..c4b16ea4dfe1 --- /dev/null +++ b/js/src/jit-test/tests/arguments/destructuring-default-value-scope.js @@ -0,0 +1,10 @@ +var a = 10; +function f1(a, + [b=(assertEq(a, 1), a=2, 42)], + {c:c=(assertEq(a, 2), a=3, 43)}) { + assertEq(a, 3); + assertEq(b, 42); + assertEq(c, 43); +} +f1(1, [], {}); +assertEq(a, 10); From 32ba31eb544dc0af1556175c8be67b54ae809da8 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Mon, 16 Feb 2015 10:28:54 +0000 Subject: [PATCH 072/115] Bug 1105644 - Lowercase words before passing them to libhyphen, so as to match patterns fully. r=smontagu --- intl/hyphenation/nsHyphenator.cpp | 44 ++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/intl/hyphenation/nsHyphenator.cpp b/intl/hyphenation/nsHyphenator.cpp index 062c24a30843..b72928f1ade2 100644 --- a/intl/hyphenation/nsHyphenator.cpp +++ b/intl/hyphenation/nsHyphenator.cpp @@ -80,9 +80,47 @@ nsHyphenator::Hyphenate(const nsAString& aString, } if (inWord) { - const char16_t *begin = aString.BeginReading(); - NS_ConvertUTF16toUTF8 utf8(begin + wordStart, - wordLimit - wordStart); + // Convert the word to utf-8 for libhyphen, lowercasing it as we go + // so that it will match the (lowercased) patterns (bug 1105644). + nsAutoCString utf8; + const char16_t* const begin = aString.BeginReading(); + const char16_t *cur = begin + wordStart; + const char16_t *end = begin + wordLimit; + while (cur < end) { + uint32_t ch = *cur++; + + if (NS_IS_HIGH_SURROGATE(ch)) { + if (cur < end && NS_IS_LOW_SURROGATE(*cur)) { + ch = SURROGATE_TO_UCS4(ch, *cur++); + } else { + ch = 0xfffd; // unpaired surrogate, treat as REPLACEMENT CHAR + } + } else if (NS_IS_LOW_SURROGATE(ch)) { + ch = 0xfffd; // unpaired surrogate + } + + // XXX What about language-specific casing? Consider Turkish I/i... + // In practice, it looks like the current patterns will not be + // affected by this, as they treat dotted and undotted i similarly. + ch = ToLowerCase(ch); + + if (ch < 0x80) { // U+0000 - U+007F + utf8.Append(ch); + } else if (ch < 0x0800) { // U+0100 - U+07FF + utf8.Append(0xC0 | (ch >> 6)); + utf8.Append(0x80 | (0x003F & ch)); + } else if (ch < 0x10000) { // U+0800 - U+D7FF,U+E000 - U+FFFF + utf8.Append(0xE0 | (ch >> 12)); + utf8.Append(0x80 | (0x003F & (ch >> 6))); + utf8.Append(0x80 | (0x003F & ch)); + } else { + utf8.Append(0xF0 | (ch >> 18)); + utf8.Append(0x80 | (0x003F & (ch >> 12))); + utf8.Append(0x80 | (0x003F & (ch >> 6))); + utf8.Append(0x80 | (0x003F & ch)); + } + } + nsAutoTArray utf8hyphens; utf8hyphens.SetLength(utf8.Length() + 5); char **rep = nullptr; From 2947df1147ce935f8bc2662838576055179fc386 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Mon, 16 Feb 2015 10:52:38 +0000 Subject: [PATCH 073/115] Bug 1105644 - Update reftests for improved handling of capitalized words. r=smontagu --- layout/reftests/text/auto-hyphenation-eo-1-ref.html | 2 +- layout/reftests/text/auto-hyphenation-nb-1-ref.html | 2 +- layout/reftests/text/auto-hyphenation-nn-1-ref.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/layout/reftests/text/auto-hyphenation-eo-1-ref.html b/layout/reftests/text/auto-hyphenation-eo-1-ref.html index f55b400d88ba..ae38a7e887b0 100644 --- a/layout/reftests/text/auto-hyphenation-eo-1-ref.html +++ b/layout/reftests/text/auto-hyphenation-eo-1-ref.html @@ -5,7 +5,7 @@

-Ĉi­uj ho­moj es­tas de­na­s­ke li­be­raj kaj ega­laj laÅ­ di­g­no kaj raj­toj. +Ĉiuj ho­moj es­tas de­na­s­ke li­be­raj kaj ega­laj laÅ­ di­g­no kaj raj­toj.
diff --git a/layout/reftests/text/auto-hyphenation-nb-1-ref.html b/layout/reftests/text/auto-hyphenation-nb-1-ref.html index ed3475108057..79ecf9b356da 100644 --- a/layout/reftests/text/auto-hyphenation-nb-1-ref.html +++ b/layout/reftests/text/auto-hyphenation-nb-1-ref.html @@ -5,7 +5,7 @@
-Al­le men­nes­ker er født frie og med sam­me men­neske­verd og men­neske­ret­tig­he­ter. +Alle men­nes­ker er født frie og med sam­me men­neske­verd og men­neske­ret­tig­he­ter.

at­ten­de diff --git a/layout/reftests/text/auto-hyphenation-nn-1-ref.html b/layout/reftests/text/auto-hyphenation-nn-1-ref.html index 8301439a9769..80f0e86fb62e 100644 --- a/layout/reftests/text/auto-hyphenation-nn-1-ref.html +++ b/layout/reftests/text/auto-hyphenation-nn-1-ref.html @@ -5,7 +5,7 @@

-Al­le men­nes­ke er fød­de til fri­dom og med same men­neske­verd og men­neske­ret­tar. +Alle men­nes­ke er fød­de til fri­dom og med same men­neske­verd og men­neske­ret­tar.

att­en­de From d505bcdca803e62f976625a751fca8bb653d1806 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Wed, 18 Feb 2015 10:38:27 -0800 Subject: [PATCH 074/115] Bug 1131375 - Message manager messages should arrive in order in non-e10s (r=smaug) --- dom/base/SameProcessMessageQueue.cpp | 72 ++++++++++++++++++++++++++ dom/base/SameProcessMessageQueue.h | 57 ++++++++++++++++++++ dom/base/moz.build | 2 + dom/base/nsFrameMessageManager.cpp | 41 ++++----------- dom/base/nsFrameMessageManager.h | 4 +- dom/base/nsInProcessTabChildGlobal.cpp | 32 ++++-------- dom/base/nsInProcessTabChildGlobal.h | 1 - 7 files changed, 154 insertions(+), 55 deletions(-) create mode 100644 dom/base/SameProcessMessageQueue.cpp create mode 100644 dom/base/SameProcessMessageQueue.h diff --git a/dom/base/SameProcessMessageQueue.cpp b/dom/base/SameProcessMessageQueue.cpp new file mode 100644 index 000000000000..0ae24174d3b7 --- /dev/null +++ b/dom/base/SameProcessMessageQueue.cpp @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "SameProcessMessageQueue.h" + +using namespace mozilla; +using namespace mozilla::dom; + +SameProcessMessageQueue* SameProcessMessageQueue::sSingleton; + +SameProcessMessageQueue::SameProcessMessageQueue() +{ +} + +SameProcessMessageQueue::~SameProcessMessageQueue() +{ + // This code should run during shutdown, and we should already have pumped the + // event loop. So we should only see messages here if someone is sending + // messages pretty late in shutdown. + NS_WARN_IF_FALSE(mQueue.IsEmpty(), "Shouldn't send messages during shutdown"); + sSingleton = nullptr; +} + +void +SameProcessMessageQueue::Push(Runnable* aRunnable) +{ + mQueue.AppendElement(aRunnable); + NS_DispatchToCurrentThread(aRunnable); +} + +void +SameProcessMessageQueue::Flush() +{ + nsTArray> queue; + mQueue.SwapElements(queue); + for (size_t i = 0; i < queue.Length(); i++) { + queue[i]->Run(); + } +} + +/* static */ SameProcessMessageQueue* +SameProcessMessageQueue::Get() +{ + if (!sSingleton) { + sSingleton = new SameProcessMessageQueue(); + } + return sSingleton; +} + +SameProcessMessageQueue::Runnable::Runnable() + : mDispatched(false) +{ +} + +NS_IMPL_ISUPPORTS(SameProcessMessageQueue::Runnable, nsIRunnable) + +nsresult +SameProcessMessageQueue::Runnable::Run() +{ + if (mDispatched) { + return NS_OK; + } + + SameProcessMessageQueue* queue = SameProcessMessageQueue::Get(); + queue->mQueue.RemoveElement(this); + + mDispatched = true; + return HandleMessage(); +} diff --git a/dom/base/SameProcessMessageQueue.h b/dom/base/SameProcessMessageQueue.h new file mode 100644 index 000000000000..eff5fb42b29b --- /dev/null +++ b/dom/base/SameProcessMessageQueue.h @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_dom_SameProcessMessageQueue_h +#define mozilla_dom_SameProcessMessageQueue_h + +#include "nsIRunnable.h" +#include "nsRefPtr.h" +#include "nsTArray.h" + +namespace mozilla { +namespace dom { + +class CancelableRunnable; + +class SameProcessMessageQueue +{ +public: + SameProcessMessageQueue(); + virtual ~SameProcessMessageQueue(); + + class Runnable : public nsIRunnable + { + public: + explicit Runnable(); + + NS_DECL_ISUPPORTS + NS_DECL_NSIRUNNABLE + + virtual nsresult HandleMessage() = 0; + + protected: + virtual ~Runnable() {} + + private: + bool mDispatched; + }; + + void Push(Runnable* aRunnable); + void Flush(); + + static SameProcessMessageQueue* Get(); + +private: + friend class CancelableRunnable; + + nsTArray> mQueue; + static SameProcessMessageQueue* sSingleton; +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_SameProcessMessageQueue_h diff --git a/dom/base/moz.build b/dom/base/moz.build index 029497ab3aa8..0f8f5816183c 100644 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -184,6 +184,7 @@ EXPORTS.mozilla.dom += [ 'PerformanceMeasure.h', 'PerformanceResourceTiming.h', 'ResponsiveImageSelector.h', + 'SameProcessMessageQueue.h', 'ScreenOrientation.h', 'ScriptSettings.h', 'ShadowRoot.h', @@ -319,6 +320,7 @@ UNIFIED_SOURCES += [ 'PerformanceMeasure.cpp', 'PerformanceResourceTiming.cpp', 'ResponsiveImageSelector.cpp', + 'SameProcessMessageQueue.cpp', 'ScriptSettings.cpp', 'ShadowRoot.cpp', 'StyleSheetList.cpp', diff --git a/dom/base/nsFrameMessageManager.cpp b/dom/base/nsFrameMessageManager.cpp index d79956c93ef3..a878053eb029 100644 --- a/dom/base/nsFrameMessageManager.cpp +++ b/dom/base/nsFrameMessageManager.cpp @@ -33,6 +33,7 @@ #include "mozilla/dom/File.h" #include "mozilla/dom/nsIContentParent.h" #include "mozilla/dom/PermissionMessageUtils.h" +#include "mozilla/dom/SameProcessMessageQueue.h" #include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/StructuredCloneUtils.h" #include "mozilla/dom/ipc/BlobChild.h" @@ -1630,7 +1631,6 @@ NS_IMPL_ISUPPORTS(nsScriptCacheCleaner, nsIObserver) nsFrameMessageManager* nsFrameMessageManager::sChildProcessManager = nullptr; nsFrameMessageManager* nsFrameMessageManager::sParentProcessManager = nullptr; nsFrameMessageManager* nsFrameMessageManager::sSameProcessParentManager = nullptr; -nsTArray >* nsFrameMessageManager::sPendingSameProcessAsyncMessages = nullptr; class nsAsyncMessageToSameProcessChild : public nsSameProcessAsyncMessageBase, public nsRunnable @@ -1779,7 +1779,7 @@ public: class nsAsyncMessageToSameProcessParent : public nsSameProcessAsyncMessageBase, - public nsRunnable + public SameProcessMessageQueue::Runnable { public: nsAsyncMessageToSameProcessParent(JSContext* aCx, @@ -1788,25 +1788,15 @@ public: JS::Handle aCpows, nsIPrincipal* aPrincipal) : nsSameProcessAsyncMessageBase(aCx, aMessage, aData, aCpows, aPrincipal) - , mDelivered(false) { } - NS_IMETHOD Run() + NS_IMETHOD HandleMessage() { - if (nsFrameMessageManager::sPendingSameProcessAsyncMessages) { - nsFrameMessageManager::sPendingSameProcessAsyncMessages->RemoveElement(this); - } - if (!mDelivered) { - mDelivered = true; - nsFrameMessageManager* ppm = nsFrameMessageManager::sSameProcessParentManager; - ReceiveMessage(static_cast(ppm), ppm); - } + nsFrameMessageManager* ppm = nsFrameMessageManager::sSameProcessParentManager; + ReceiveMessage(static_cast(ppm), ppm); return NS_OK; } - -private: - bool mDelivered; }; /** @@ -1832,15 +1822,9 @@ public: InfallibleTArray* aJSONRetVal, bool aIsSync) MOZ_OVERRIDE { - nsTArray > asyncMessages; - if (nsFrameMessageManager::sPendingSameProcessAsyncMessages) { - asyncMessages.SwapElements(*nsFrameMessageManager::sPendingSameProcessAsyncMessages); - uint32_t len = asyncMessages.Length(); - for (uint32_t i = 0; i < len; ++i) { - nsCOMPtr async = asyncMessages[i]; - async->Run(); - } - } + SameProcessMessageQueue* queue = SameProcessMessageQueue::Get(); + queue->Flush(); + if (nsFrameMessageManager::sSameProcessParentManager) { SameProcessCpowHolder cpows(js::GetRuntime(aCx), aCpows); nsRefPtr ppm = nsFrameMessageManager::sSameProcessParentManager; @@ -1856,13 +1840,10 @@ public: JS::Handle aCpows, nsIPrincipal* aPrincipal) MOZ_OVERRIDE { - if (!nsFrameMessageManager::sPendingSameProcessAsyncMessages) { - nsFrameMessageManager::sPendingSameProcessAsyncMessages = new nsTArray >; - } - nsCOMPtr ev = + SameProcessMessageQueue* queue = SameProcessMessageQueue::Get(); + nsRefPtr ev = new nsAsyncMessageToSameProcessParent(aCx, aMessage, aData, aCpows, aPrincipal); - nsFrameMessageManager::sPendingSameProcessAsyncMessages->AppendElement(ev); - NS_DispatchToCurrentThread(ev); + queue->Push(ev); return true; } diff --git a/dom/base/nsFrameMessageManager.h b/dom/base/nsFrameMessageManager.h index 30708cf534f4..0b0dbd15da0c 100644 --- a/dom/base/nsFrameMessageManager.h +++ b/dom/base/nsFrameMessageManager.h @@ -27,6 +27,7 @@ #include "mozilla/Attributes.h" #include "js/RootingAPI.h" #include "nsTObserverArray.h" +#include "mozilla/dom/SameProcessMessageQueue.h" #include "mozilla/dom/StructuredCloneUtils.h" #include "mozilla/jsipc/CpowHolder.h" @@ -200,8 +201,7 @@ private: } if (this == sChildProcessManager) { sChildProcessManager = nullptr; - delete sPendingSameProcessAsyncMessages; - sPendingSameProcessAsyncMessages = nullptr; + delete mozilla::dom::SameProcessMessageQueue::Get(); } if (this == sSameProcessParentManager) { sSameProcessParentManager = nullptr; diff --git a/dom/base/nsInProcessTabChildGlobal.cpp b/dom/base/nsInProcessTabChildGlobal.cpp index 04500690f86c..551f8a3f41d7 100644 --- a/dom/base/nsInProcessTabChildGlobal.cpp +++ b/dom/base/nsInProcessTabChildGlobal.cpp @@ -19,6 +19,7 @@ #include "nsIMozBrowserFrame.h" #include "nsDOMClassInfoID.h" #include "mozilla/EventDispatcher.h" +#include "mozilla/dom/SameProcessMessageQueue.h" #include "mozilla/dom/StructuredCloneUtils.h" #include "js/StructuredClone.h" @@ -35,13 +36,9 @@ nsInProcessTabChildGlobal::DoSendBlockingMessage(JSContext* aCx, InfallibleTArray* aJSONRetVal, bool aIsSync) { - nsTArray > asyncMessages; - asyncMessages.SwapElements(mASyncMessages); - uint32_t len = asyncMessages.Length(); - for (uint32_t i = 0; i < len; ++i) { - nsCOMPtr async = asyncMessages[i]; - async->Run(); - } + SameProcessMessageQueue* queue = SameProcessMessageQueue::Get(); + queue->Flush(); + if (mChromeMessageManager) { SameProcessCpowHolder cpows(js::GetRuntime(aCx), aCpows); nsRefPtr mm = mChromeMessageManager; @@ -52,7 +49,7 @@ nsInProcessTabChildGlobal::DoSendBlockingMessage(JSContext* aCx, } class nsAsyncMessageToParent : public nsSameProcessAsyncMessageBase, - public nsRunnable + public SameProcessMessageQueue::Runnable { public: nsAsyncMessageToParent(JSContext* aCx, @@ -62,25 +59,16 @@ public: JS::Handle aCpows, nsIPrincipal* aPrincipal) : nsSameProcessAsyncMessageBase(aCx, aMessage, aData, aCpows, aPrincipal), - mTabChild(aTabChild), mRun(false) + mTabChild(aTabChild) { } - NS_IMETHOD Run() + NS_IMETHOD HandleMessage() { - if (mRun) { - return NS_OK; - } - - mRun = true; - mTabChild->mASyncMessages.RemoveElement(this); ReceiveMessage(mTabChild->mOwner, mTabChild->mChromeMessageManager); return NS_OK; } nsRefPtr mTabChild; - // True if this runnable has already been called. This can happen if DoSendSyncMessage - // is called while waiting for an asynchronous message send. - bool mRun; }; bool @@ -90,10 +78,10 @@ nsInProcessTabChildGlobal::DoSendAsyncMessage(JSContext* aCx, JS::Handle aCpows, nsIPrincipal* aPrincipal) { - nsCOMPtr ev = + SameProcessMessageQueue* queue = SameProcessMessageQueue::Get(); + nsRefPtr ev = new nsAsyncMessageToParent(aCx, this, aMessage, aData, aCpows, aPrincipal); - mASyncMessages.AppendElement(ev); - NS_DispatchToCurrentThread(ev); + queue->Push(ev); return true; } diff --git a/dom/base/nsInProcessTabChildGlobal.h b/dom/base/nsInProcessTabChildGlobal.h index de5313e007aa..655b11e03a6a 100644 --- a/dom/base/nsInProcessTabChildGlobal.h +++ b/dom/base/nsInProcessTabChildGlobal.h @@ -175,7 +175,6 @@ protected: public: nsIContent* mOwner; nsFrameMessageManager* mChromeMessageManager; - nsTArray > mASyncMessages; }; #endif From c5fed0b790202e5458eaaae57f23a6e2a5948b98 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Wed, 18 Feb 2015 10:38:41 -0800 Subject: [PATCH 075/115] Bug 1131375 - Test for message ordering (r=Mossop) --- dom/base/test/browser.ini | 1 + dom/base/test/browser_ipc_order.js | 83 ++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 dom/base/test/browser_ipc_order.js diff --git a/dom/base/test/browser.ini b/dom/base/test/browser.ini index 923b7cc35a24..4b46267ffed7 100644 --- a/dom/base/test/browser.ini +++ b/dom/base/test/browser.ini @@ -9,3 +9,4 @@ skip-if = e10s # Bug ?????? - test e10s utils don't support load events from ifr skip-if = true # Intermittent failures - bug 987493. Restore the skip-if above once fixed [browser_bug1058164.js] skip-if = e10s # We need bug 918634 to land before this can be tested with e10s. +[browser_ipc_order.js] diff --git a/dom/base/test/browser_ipc_order.js b/dom/base/test/browser_ipc_order.js new file mode 100644 index 000000000000..e77f6215e208 --- /dev/null +++ b/dom/base/test/browser_ipc_order.js @@ -0,0 +1,83 @@ +add_task(function*() { + let frame_script = () => { + const { classes: Cc, interfaces: Ci } = Components; + let cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]. + getService(Ci.nsISyncMessageSender); + + sendAsyncMessage("Test:Frame:Async"); + cpmm.sendAsyncMessage("Test:Process:Async"); + cpmm.sendSyncMessage("Test:Process:Sync"); + }; + + // This must be a page that opens in the main process + let tab = gBrowser.addTab("about:robots"); + let browser = tab.linkedBrowser; + let mm = browser.messageManager; + let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"]. + getService(Ci.nsIMessageBroadcaster); + yield new Promise(resolve => browser.addEventListener("load", resolve, true)); + + let messages = []; + let promise = new Promise(resolve => { + let listener = message => { + messages.push(message.name) + if (messages.length == 3) + resolve(); + }; + + mm.addMessageListener("Test:Frame:Async", listener); + ppmm.addMessageListener("Test:Process:Async", listener); + ppmm.addMessageListener("Test:Process:Sync", listener); + }); + + mm.loadFrameScript("data:,(" + frame_script.toString() + ")();", false); + yield promise; + + gBrowser.removeTab(tab); + + is(messages[0], "Test:Frame:Async", "Expected async frame message"); + is(messages[1], "Test:Process:Async", "Expected async process message"); + is(messages[2], "Test:Process:Sync", "Expected sync process message"); +}); + +add_task(function*() { + let frame_script = () => { + const { classes: Cc, interfaces: Ci } = Components; + let cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"]. + getService(Ci.nsISyncMessageSender); + + cpmm.sendAsyncMessage("Test:Process:Async"); + sendAsyncMessage("Test:Frame:Async"); + sendSyncMessage("Test:Frame:Sync"); + }; + + // This must be a page that opens in the main process + let tab = gBrowser.addTab("about:robots"); + let browser = tab.linkedBrowser; + let mm = browser.messageManager; + let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"]. + getService(Ci.nsIMessageBroadcaster); + yield new Promise(resolve => browser.addEventListener("load", resolve, true)); + + let messages = []; + let promise = new Promise(resolve => { + let listener = message => { + messages.push(message.name) + if (messages.length == 3) + resolve(); + }; + + ppmm.addMessageListener("Test:Process:Async", listener); + mm.addMessageListener("Test:Frame:Async", listener); + mm.addMessageListener("Test:Frame:Sync", listener); + }); + + mm.loadFrameScript("data:,(" + frame_script.toString() + ")();", false); + yield promise; + + gBrowser.removeTab(tab); + + is(messages[0], "Test:Process:Async", "Expected async process message"); + is(messages[1], "Test:Frame:Async", "Expected async frame message"); + is(messages[2], "Test:Frame:Sync", "Expected sync frame message"); +}); From c2f40fe8a3a4363574963a22f0863f415d5146a9 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Wed, 18 Feb 2015 10:42:28 -0800 Subject: [PATCH 076/115] Bug 1131317 - Always unwrap objects before wrapping them in XPCWrappedJS (r=mrbkap) --- dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html | 2 +- js/xpconnect/loader/XPCOMUtils.jsm | 3 ++- js/xpconnect/src/XPCWrappedJSClass.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html index b99bae634c6b..07f998f63821 100644 --- a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html +++ b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html @@ -42,11 +42,11 @@ if (OfflineTest.setup()) { updateStateChanged: function (aUpdate, aState) { switch(aState) { case Ci.nsIOfflineCacheUpdateObserver.STATE_ERROR: - aUpdate.removeObserver(this); errorReceived = true; OfflineTest.ok(true, "Expected error. Update canceled"); break; case Ci.nsIOfflineCacheUpdateObserver.STATE_FINISHED: + aUpdate.removeObserver(this); OfflineTest.ok(errorReceived, "Finished after receiving the expected error"); finish(); diff --git a/js/xpconnect/loader/XPCOMUtils.jsm b/js/xpconnect/loader/XPCOMUtils.jsm index 67a67bd1dc77..9e1afbc1e06c 100644 --- a/js/xpconnect/loader/XPCOMUtils.jsm +++ b/js/xpconnect/loader/XPCOMUtils.jsm @@ -290,7 +290,8 @@ this.XPCOMUtils = { if (outer) throw Cr.NS_ERROR_NO_AGGREGATION; return (new component()).QueryInterface(iid); - } + }, + QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory]) } } return factory; diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index f930756fb649..6a9d638459a7 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -592,7 +592,7 @@ nsXPCWrappedJSClass::GetRootJSObject(JSContext* cx, JSObject* aJSObjArg) JSObject* result = CallQueryInterfaceOnJSObject(cx, aJSObj, NS_GET_IID(nsISupports)); if (!result) - return aJSObj; + result = aJSObj; JSObject* inner = js::UncheckedUnwrap(result); if (inner) return inner; From 620448450cfc4a05326da07ddf9e191831056703 Mon Sep 17 00:00:00 2001 From: Kannan Vijayan Date: Wed, 18 Feb 2015 14:03:13 -0500 Subject: [PATCH 077/115] Bug 1131295 - Fix profiler frontend category mappings. r=vporof --- .../test/browser_profiler_tree-frame-node.js | 3 +- .../test/browser_profiler_tree-view-02.js | 34 ++++----- .../test/browser_profiler_tree-view-04.js | 35 +++++----- browser/devtools/shared/profiler/global.js | 69 ++++++++++++++++--- 4 files changed, 96 insertions(+), 45 deletions(-) diff --git a/browser/devtools/performance/test/browser_profiler_tree-frame-node.js b/browser/devtools/performance/test/browser_profiler_tree-frame-node.js index d127e88689a1..1ec578bc0f37 100644 --- a/browser/devtools/performance/test/browser_profiler_tree-frame-node.js +++ b/browser/devtools/performance/test/browser_profiler_tree-frame-node.js @@ -7,6 +7,7 @@ function test() { let { FrameNode } = devtools.require("devtools/shared/profiler/tree-model"); + let { CATEGORY_OTHER } = devtools.require("devtools/shared/profiler/global"); let frame1 = new FrameNode({ location: "hello/<.world (http://foo/bar.js:123:987)", @@ -132,7 +133,7 @@ function test() { location: "Foo::Bar::Baz", line: 456, column: 123, - category: 8 + category: CATEGORY_OTHER }); is(frame6.getInfo().nodeType, "Frame", diff --git a/browser/devtools/performance/test/browser_profiler_tree-view-02.js b/browser/devtools/performance/test/browser_profiler_tree-view-02.js index 7fa9e4988674..0f10c9532d16 100644 --- a/browser/devtools/performance/test/browser_profiler_tree-view-02.js +++ b/browser/devtools/performance/test/browser_profiler_tree-view-02.js @@ -6,6 +6,8 @@ * creates the correct column structure after expanding some of the nodes. */ +let { CATEGORY_MASK } = devtools.require("devtools/shared/profiler/global"); + function test() { let { ThreadNode } = devtools.require("devtools/shared/profiler/tree-model"); let { CallView } = devtools.require("devtools/shared/profiler/tree-view"); @@ -126,33 +128,33 @@ function test() { let gSamples = [{ time: 5, frames: [ - { category: 8, location: "(root)" }, - { category: 8, location: "A (http://foo/bar/baz:12)" }, - { category: 16, location: "B (http://foo/bar/baz:34)" }, - { category: 32, location: "C (http://foo/bar/baz:56)" } + { category: CATEGORY_MASK('other'), location: "(root)" }, + { category: CATEGORY_MASK('other'), location: "A (http://foo/bar/baz:12)" }, + { category: CATEGORY_MASK('css'), location: "B (http://foo/bar/baz:34)" }, + { category: CATEGORY_MASK('js'), location: "C (http://foo/bar/baz:56)" } ] }, { time: 5 + 1, frames: [ - { category: 8, location: "(root)" }, - { category: 8, location: "A (http://foo/bar/baz:12)" }, - { category: 16, location: "B (http://foo/bar/baz:34)" }, - { category: 64, location: "D (http://foo/bar/baz:78)" } + { category: CATEGORY_MASK('other'), location: "(root)" }, + { category: CATEGORY_MASK('other'), location: "A (http://foo/bar/baz:12)" }, + { category: CATEGORY_MASK('css'), location: "B (http://foo/bar/baz:34)" }, + { category: CATEGORY_MASK('gc', 1), location: "D (http://foo/bar/baz:78)" } ] }, { time: 5 + 1 + 2, frames: [ - { category: 8, location: "(root)" }, - { category: 8, location: "A (http://foo/bar/baz:12)" }, - { category: 16, location: "B (http://foo/bar/baz:34)" }, - { category: 64, location: "D (http://foo/bar/baz:78)" } + { category: CATEGORY_MASK('other'), location: "(root)" }, + { category: CATEGORY_MASK('other'), location: "A (http://foo/bar/baz:12)" }, + { category: CATEGORY_MASK('css'), location: "B (http://foo/bar/baz:34)" }, + { category: CATEGORY_MASK('gc', 1), location: "D (http://foo/bar/baz:78)" } ] }, { time: 5 + 1 + 2 + 7, frames: [ - { category: 8, location: "(root)" }, - { category: 8, location: "A (http://foo/bar/baz:12)" }, - { category: 128, location: "E (http://foo/bar/baz:90)" }, - { category: 256, location: "F (http://foo/bar/baz:99)" } + { category: CATEGORY_MASK('other'), location: "(root)" }, + { category: CATEGORY_MASK('other'), location: "A (http://foo/bar/baz:12)" }, + { category: CATEGORY_MASK('gc', 2), location: "E (http://foo/bar/baz:90)" }, + { category: CATEGORY_MASK('network'), location: "F (http://foo/bar/baz:99)" } ] }]; diff --git a/browser/devtools/performance/test/browser_profiler_tree-view-04.js b/browser/devtools/performance/test/browser_profiler_tree-view-04.js index 2926c67c1e3a..4b9d3f993910 100644 --- a/browser/devtools/performance/test/browser_profiler_tree-view-04.js +++ b/browser/devtools/performance/test/browser_profiler_tree-view-04.js @@ -6,6 +6,8 @@ * creates the correct DOM nodes in the correct order. */ +let { CATEGORY_MASK } = devtools.require("devtools/shared/profiler/global"); + function test() { let { ThreadNode } = devtools.require("devtools/shared/profiler/tree-model"); let { CallView } = devtools.require("devtools/shared/profiler/tree-view"); @@ -90,34 +92,33 @@ function test() { let gSamples = [{ time: 5, frames: [ - { category: 8, location: "(root)" }, - { category: 8, location: "A (http://foo/bar/baz:12)" }, - { category: 16, location: "B (http://foo/bar/baz:34)" }, - { category: 32, location: "C (http://foo/bar/baz:56)" } + { category: CATEGORY_MASK('other'), location: "(root)" }, + { category: CATEGORY_MASK('other'), location: "A (http://foo/bar/baz:12)" }, + { category: CATEGORY_MASK('css'), location: "B (http://foo/bar/baz:34)" }, + { category: CATEGORY_MASK('js'), location: "C (http://foo/bar/baz:56)" } ] }, { time: 5 + 1, frames: [ - { category: 8, location: "(root)" }, - { category: 8, location: "A (http://foo/bar/baz:12)" }, - { category: 16, location: "B (http://foo/bar/baz:34)" }, - { category: 64, location: "D (http://foo/bar/baz:78)" } + { category: CATEGORY_MASK('other'), location: "(root)" }, + { category: CATEGORY_MASK('other'), location: "A (http://foo/bar/baz:12)" }, + { category: CATEGORY_MASK('css'), location: "B (http://foo/bar/baz:34)" }, + { category: CATEGORY_MASK('gc', 1), location: "D (http://foo/bar/baz:78)" } ] }, { time: 5 + 1 + 2, frames: [ - { category: 8, location: "(root)" }, - { category: 8, location: "A (http://foo/bar/baz:12)" }, - { category: 16, location: "B (http://foo/bar/baz:34)" }, - { category: 64, location: "D (http://foo/bar/baz:78)" } + { category: CATEGORY_MASK('other'), location: "(root)" }, + { category: CATEGORY_MASK('other'), location: "A (http://foo/bar/baz:12)" }, + { category: CATEGORY_MASK('css'), location: "B (http://foo/bar/baz:34)" }, + { category: CATEGORY_MASK('gc', 1), location: "D (http://foo/bar/baz:78)" } ] }, { time: 5 + 1 + 2 + 7, frames: [ - { category: 8, location: "(root)" }, - { category: 8, location: "A (http://foo/bar/baz:12)" }, - { category: 128, location: "E (http://foo/bar/baz:90)" }, - { category: 256, location: "F (http://foo/bar/baz:99)" } + { category: CATEGORY_MASK('other'), location: "(root)" }, + { category: CATEGORY_MASK('other'), location: "A (http://foo/bar/baz:12)" }, + { category: CATEGORY_MASK('gc', 2), location: "E (http://foo/bar/baz:90)" }, + { category: CATEGORY_MASK('network'), location: "F (http://foo/bar/baz:99)" } ] }]; - diff --git a/browser/devtools/shared/profiler/global.js b/browser/devtools/shared/profiler/global.js index e8e084fd83d6..0a89be089bb0 100644 --- a/browser/devtools/shared/profiler/global.js +++ b/browser/devtools/shared/profiler/global.js @@ -33,25 +33,70 @@ const CATEGORIES = [ * To be kept in sync with the js::ProfileEntry::Category in ProfilingStack.h */ const CATEGORY_MAPPINGS = { - "8": CATEGORIES[0], // js::ProfileEntry::Category::OTHER - "16": CATEGORIES[1], // js::ProfileEntry::Category::CSS - "32": CATEGORIES[2], // js::ProfileEntry::Category::JS - "64": CATEGORIES[3], // js::ProfileEntry::Category::GC - "128": CATEGORIES[3], // js::ProfileEntry::Category::CC - "256": CATEGORIES[4], // js::ProfileEntry::Category::NETWORK - "512": CATEGORIES[5], // js::ProfileEntry::Category::GRAPHICS - "1024": CATEGORIES[6], // js::ProfileEntry::Category::STORAGE - "2048": CATEGORIES[7], // js::ProfileEntry::Category::EVENTS + "16": CATEGORIES[0], // js::ProfileEntry::Category::OTHER + "32": CATEGORIES[1], // js::ProfileEntry::Category::CSS + "64": CATEGORIES[2], // js::ProfileEntry::Category::JS + "128": CATEGORIES[3], // js::ProfileEntry::Category::GC + "256": CATEGORIES[3], // js::ProfileEntry::Category::CC + "512": CATEGORIES[4], // js::ProfileEntry::Category::NETWORK + "1024": CATEGORIES[5], // js::ProfileEntry::Category::GRAPHICS + "2048": CATEGORIES[6], // js::ProfileEntry::Category::STORAGE + "4096": CATEGORIES[7], // js::ProfileEntry::Category::EVENTS }; +/** + * Get the numeric bitmask (or set of masks) for the given category + * abbreviation. See CATEGORIES and CATEGORY_MAPPINGS above. + * + * CATEGORY_MASK can be called with just a name if it is expected that the + * category is mapped to by exactly one bitmask. If the category is mapped + * to by multiple masks, CATEGORY_MASK for that name must be called with + * an additional argument specifying the desired id (in ascending order). + */ +const [CATEGORY_MASK, CATEGORY_MASK_LIST] = (function () { + let mappings = {}; + for (let category of CATEGORIES) { + let numList = Object.keys(CATEGORY_MAPPINGS) + .filter(k => CATEGORY_MAPPINGS[k] == category) + .map(k => +k); + numList.sort(); + mappings[category.abbrev] = numList; + } + + return [ + function (name, num) { + if (!(name in mappings)) { + throw new Error(`Category abbreviation '${name}' does not exist.`); + } + if (arguments.length == 1) { + if (mappings[name].length != 1) { + throw new Error(`Expected exactly one category number for '${name}'.`); + } + return mappings[name][0]; + } + if (num > mappings[name].length) { + throw new Error(`Num '${num}' too high for category '${name}'.`); + } + return mappings[name][num - 1]; + }, + + function (name) { + if (!(name in mappings)) { + throw new Error(`Category abbreviation '${name}' does not exist.`); + } + return mappings[name]; + } + ]; +})(); + // Human-readable "other" category bitmask. Older Geckos don't have all the // necessary instrumentation in the sampling profiler backend for creating // a categories graph, in which case we default to the "other" category. -const CATEGORY_OTHER = 8; +const CATEGORY_OTHER = CATEGORY_MASK('other'); // Human-readable JIT category bitmask. Certain pseudo-frames in a sample, // like "EnterJIT", don't have any associated `cateogry` information. -const CATEGORY_JIT = 32; +const CATEGORY_JIT = CATEGORY_MASK('js'); // Exported symbols. exports.L10N = L10N; @@ -59,3 +104,5 @@ exports.CATEGORIES = CATEGORIES; exports.CATEGORY_MAPPINGS = CATEGORY_MAPPINGS; exports.CATEGORY_OTHER = CATEGORY_OTHER; exports.CATEGORY_JIT = CATEGORY_JIT; +exports.CATEGORY_MASK = CATEGORY_MASK; +exports.CATEGORY_MASK_LIST = CATEGORY_MASK_LIST; From 7f6b5207310b4ad86cb6755a23ced8aa3e16c86d Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Wed, 18 Feb 2015 09:19:38 -0800 Subject: [PATCH 078/115] bug 1134246 - compartment name not shown in about:compartments r=mossop --- .../components/aboutcompartments/content/aboutCompartments.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/components/aboutcompartments/content/aboutCompartments.js b/toolkit/components/aboutcompartments/content/aboutCompartments.js index 69535c3c9bfb..fbcac91bc99a 100644 --- a/toolkit/components/aboutcompartments/content/aboutCompartments.js +++ b/toolkit/components/aboutcompartments/content/aboutCompartments.js @@ -59,7 +59,7 @@ function go() { name.className = "addon"; time.className = "time"; cpow.className = "cpow"; - name.textContent = comp.label; + name.textContent = comp.compartmentName; time.textContent = comp.time +"μs"; cpow.textContent = comp.CPOWTime +"μs"; c.appendChild(time); From cb61a019fcead3e264d61010f5fe7407a87c9f8f Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Wed, 18 Feb 2015 14:10:52 -0500 Subject: [PATCH 079/115] Bug 1065216 - Dispatch a fetch event to workers when controlled pages initiate a network load. r=baku,mayhemer,smaug --- docshell/base/nsDocShell.cpp | 48 +++ docshell/base/nsDocShell.h | 3 + dom/base/nsDocument.h | 2 +- dom/bindings/Bindings.conf | 8 + dom/fetch/Fetch.cpp | 5 + dom/fetch/Fetch.h | 16 +- .../base/nsIServiceWorkerManager.idl | 12 +- dom/webidl/FetchEvent.webidl | 27 ++ dom/webidl/moz.build | 1 + dom/workers/ServiceWorkerEvents.cpp | 276 +++++++++++++++++ dom/workers/ServiceWorkerEvents.h | 75 +++++ dom/workers/ServiceWorkerManager.cpp | 287 +++++++++++++++++- dom/workers/ServiceWorkerManager.h | 3 + .../test/serviceworkers/fetch/fetch_tests.js | 54 ++++ .../fetch/fetch_worker_script.js | 29 ++ .../test/serviceworkers/fetch/index.html | 147 +++++++++ .../test/serviceworkers/fetch_event_worker.js | 86 ++++++ dom/workers/test/serviceworkers/mochitest.ini | 5 + .../test/serviceworkers/test_fetch_event.html | 61 ++++ .../base/nsINetworkInterceptController.idl | 34 ++- netwerk/protocol/http/HttpBaseChannel.cpp | 10 +- netwerk/protocol/http/HttpBaseChannel.h | 2 +- netwerk/protocol/http/HttpChannelChild.cpp | 203 ++++++++----- netwerk/protocol/http/HttpChannelChild.h | 2 +- netwerk/protocol/http/InterceptedChannel.cpp | 98 ++++-- netwerk/protocol/http/InterceptedChannel.h | 31 +- .../test/unit/test_synthesized_response.js | 73 ++++- 27 files changed, 1450 insertions(+), 148 deletions(-) create mode 100644 dom/webidl/FetchEvent.webidl create mode 100644 dom/workers/test/serviceworkers/fetch/fetch_tests.js create mode 100644 dom/workers/test/serviceworkers/fetch/fetch_worker_script.js create mode 100644 dom/workers/test/serviceworkers/fetch/index.html create mode 100644 dom/workers/test/serviceworkers/fetch_event_worker.js create mode 100644 dom/workers/test/serviceworkers/test_fetch_event.html diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index d6f2faf92e04..48e9612f457b 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -52,6 +52,7 @@ #include "nsIAuthPrompt2.h" #include "nsIChannelEventSink.h" #include "nsIAsyncVerifyRedirectCallback.h" +#include "nsIServiceWorkerManager.h" #include "nsIScriptSecurityManager.h" #include "nsIScriptObjectPrincipal.h" #include "nsIScrollableFrame.h" @@ -1041,6 +1042,7 @@ NS_INTERFACE_MAP_BEGIN(nsDocShell) NS_INTERFACE_MAP_ENTRY(nsILinkHandler) NS_INTERFACE_MAP_ENTRY(nsIClipboardCommands) NS_INTERFACE_MAP_ENTRY(nsIDOMStorageManager) + NS_INTERFACE_MAP_ENTRY(nsINetworkInterceptController) NS_INTERFACE_MAP_END_INHERITING(nsDocLoader) ///***************************************************************************** @@ -13921,6 +13923,52 @@ nsDocShell::MaybeNotifyKeywordSearchLoading(const nsString& aProvider, #endif } +NS_IMETHODIMP +nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate, bool* aShouldIntercept) +{ + *aShouldIntercept = false; + nsCOMPtr swm = mozilla::services::GetServiceWorkerManager(); + if (!swm) { + return NS_OK; + } + + if (aIsNavigate) { + return swm->IsAvailableForURI(aURI, aShouldIntercept); + } + + nsCOMPtr doc = GetDocument(); + if (!doc) { + return NS_ERROR_NOT_AVAILABLE; + } + + return swm->IsControlled(doc, aShouldIntercept); +} + +NS_IMETHODIMP +nsDocShell::ChannelIntercepted(nsIInterceptedChannel* aChannel) +{ + nsCOMPtr swm = mozilla::services::GetServiceWorkerManager(); + if (!swm) { + aChannel->Cancel(); + return NS_OK; + } + + bool isNavigation = false; + nsresult rv = aChannel->GetIsNavigation(&isNavigation); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr doc; + + if (!isNavigation) { + doc = GetDocument(); + if (!doc) { + return NS_ERROR_NOT_AVAILABLE; + } + } + + return swm->DispatchFetchEvent(doc, aChannel); +} + NS_IMETHODIMP nsDocShell::SetPaymentRequestId(const nsAString& aPaymentRequestId) { diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index d1a8ad2088a1..9b5094f2715f 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -12,6 +12,7 @@ #include "nsIDocShell.h" #include "nsIDocShellTreeItem.h" #include "nsIBaseWindow.h" +#include "nsINetworkInterceptController.h" #include "nsIScrollable.h" #include "nsITextScroll.h" #include "nsIContentViewerContainer.h" @@ -152,6 +153,7 @@ class nsDocShell MOZ_FINAL , public nsILinkHandler , public nsIClipboardCommands , public nsIDOMStorageManager + , public nsINetworkInterceptController , public mozilla::SupportsWeakPtr { friend class nsDSURIContentListener; @@ -182,6 +184,7 @@ public: NS_DECL_NSIAUTHPROMPTPROVIDER NS_DECL_NSICLIPBOARDCOMMANDS NS_DECL_NSIWEBSHELLSERVICES + NS_DECL_NSINETWORKINTERCEPTCONTROLLER NS_FORWARD_SAFE_NSIDOMSTORAGEMANAGER(TopSessionStorageManager()) NS_IMETHOD Stop() MOZ_OVERRIDE { diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index 2b3269416500..3cbd872af6be 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -622,7 +622,7 @@ protected: DECL_SHIM(nsIApplicationCacheContainer, NSIAPPLICATIONCACHECONTAINER) #undef DECL_SHIM }; - + /** * Add an ExternalResource for aURI. aViewer and aLoadGroup might be null * when this is called if the URI didn't result in an XML document. This diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 3d3390fc2ac6..6555867e4241 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -418,6 +418,14 @@ DOMInterfaces = { 'nativeType': 'mozilla::dom::workers::ExtendableEvent', }, +'FetchEvent': { + 'headerFile': 'ServiceWorkerEvents.h', + 'nativeType': 'mozilla::dom::workers::FetchEvent', + 'binaryNames': { + 'request': 'request_' + }, +}, + 'FileList': { 'headerFile': 'mozilla/dom/File.h', }, diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp index 9abbd7824c3e..ce1e7c822c55 100644 --- a/dom/fetch/Fetch.cpp +++ b/dom/fetch/Fetch.cpp @@ -866,6 +866,11 @@ FetchBody::FetchBody(); template FetchBody::FetchBody(); +template +FetchBody::~FetchBody() +{ +} + // Returns true if addref succeeded. // Always succeeds on main thread. // May fail on worker if RegisterFeature() fails. In that case, it will release diff --git a/dom/fetch/Fetch.h b/dom/fetch/Fetch.h index d3090fea1a5e..6b86f0d444af 100644 --- a/dom/fetch/Fetch.h +++ b/dom/fetch/Fetch.h @@ -135,6 +135,12 @@ public: void CancelPump(); + void + SetBodyUsed() + { + mBodyUsed = true; + } + // Always set whenever the FetchBody is created on the worker thread. workers::WorkerPrivate* mWorkerPrivate; @@ -145,15 +151,7 @@ public: protected: FetchBody(); - virtual ~FetchBody() - { - } - - void - SetBodyUsed() - { - mBodyUsed = true; - } + virtual ~FetchBody(); void SetMimeType(ErrorResult& aRv); diff --git a/dom/interfaces/base/nsIServiceWorkerManager.idl b/dom/interfaces/base/nsIServiceWorkerManager.idl index acd45e9d5182..2cec7919a442 100644 --- a/dom/interfaces/base/nsIServiceWorkerManager.idl +++ b/dom/interfaces/base/nsIServiceWorkerManager.idl @@ -6,6 +6,7 @@ #include "domstubs.idl" interface nsIDocument; +interface nsIInterceptedChannel; interface nsIPrincipal; interface nsIURI; @@ -18,7 +19,7 @@ interface nsIServiceWorkerUnregisterCallback : nsISupports [noscript] void UnregisterFailed(); }; -[builtinclass, uuid(861b55e9-d6ac-47cf-a528-8590e9b44de6)] +[builtinclass, uuid(464882c8-81c0-4620-b9c4-44c12085b65b)] interface nsIServiceWorkerManager : nsISupports { /** @@ -51,6 +52,15 @@ interface nsIServiceWorkerManager : nsISupports // Remove ready pending Promise void removeReadyPromise(in nsIDOMWindow aWindow); + // Returns true if a ServiceWorker is available for the scope of aURI. + bool isAvailableForURI(in nsIURI aURI); + + // Returns true if a given document is currently controlled by a ServiceWorker + bool isControlled(in nsIDocument aDocument); + + // Cause a fetch event to be dispatched to the worker global associated with the given document. + void dispatchFetchEvent(in nsIDocument aDoc, in nsIInterceptedChannel aChannel); + // aTarget MUST be a ServiceWorkerRegistration. [noscript] void AddRegistrationEventListener(in DOMString aScope, in nsIDOMEventTarget aTarget); [noscript] void RemoveRegistrationEventListener(in DOMString aScope, in nsIDOMEventTarget aTarget); diff --git a/dom/webidl/FetchEvent.webidl b/dom/webidl/FetchEvent.webidl new file mode 100644 index 000000000000..20c378176743 --- /dev/null +++ b/dom/webidl/FetchEvent.webidl @@ -0,0 +1,27 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * For more information on this interface, please see + * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + */ + +[Constructor(DOMString type, optional FetchEventInit eventInitDict), + Func="mozilla::dom::workers::ServiceWorkerVisible", + Exposed=(ServiceWorker)] +interface FetchEvent : Event { + readonly attribute Request request; + readonly attribute ServiceWorkerClient client; // The window issuing the request. + readonly attribute boolean isReload; + + [Throws] void respondWith(Promise r); + Promise forwardTo(USVString url); + Promise default(); +}; + +dictionary FetchEventInit : EventInit { + Request request; + ServiceWorkerClient client; + boolean isReload; +}; diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 6cd53553419c..4cdf32fcff68 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -132,6 +132,7 @@ WEBIDL_FILES = [ 'EventTarget.webidl', 'ExtendableEvent.webidl', 'Fetch.webidl', + 'FetchEvent.webidl', 'File.webidl', 'FileList.webidl', 'FileMode.webidl', diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/workers/ServiceWorkerEvents.cpp index 2e53e4d6d598..6199f3b5f405 100644 --- a/dom/workers/ServiceWorkerEvents.cpp +++ b/dom/workers/ServiceWorkerEvents.cpp @@ -5,9 +5,20 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ServiceWorkerEvents.h" +#include "ServiceWorkerClient.h" +#include "nsINetworkInterceptController.h" +#include "nsIOutputStream.h" #include "nsContentUtils.h" +#include "nsComponentManagerUtils.h" +#include "nsServiceManagerUtils.h" +#include "nsStreamUtils.h" +#include "nsNetCID.h" +#include "mozilla/dom/FetchEventBinding.h" +#include "mozilla/dom/PromiseNativeHandler.h" +#include "mozilla/dom/Request.h" +#include "mozilla/dom/Response.h" #include "mozilla/dom/WorkerScope.h" #include "mozilla/dom/workers/bindings/ServiceWorker.h" @@ -15,6 +26,271 @@ using namespace mozilla::dom; BEGIN_WORKERS_NAMESPACE +FetchEvent::FetchEvent(EventTarget* aOwner) +: Event(aOwner, nullptr, nullptr) +, mWindowId(0) +, mIsReload(false) +, mWaitToRespond(false) +{ +} + +FetchEvent::~FetchEvent() +{ +} + +void +FetchEvent::PostInit(nsMainThreadPtrHandle& aChannel, + nsMainThreadPtrHandle& aServiceWorker, + uint64_t aWindowId) +{ + mChannel = aChannel; + mServiceWorker = aServiceWorker; + mWindowId = aWindowId; +} + +/*static*/ already_AddRefed +FetchEvent::Constructor(const GlobalObject& aGlobal, + const nsAString& aType, + const FetchEventInit& aOptions, + ErrorResult& aRv) +{ + nsRefPtr owner = do_QueryObject(aGlobal.GetAsSupports()); + MOZ_ASSERT(owner); + nsRefPtr e = new FetchEvent(owner); + bool trusted = e->Init(owner); + e->InitEvent(aType, aOptions.mBubbles, aOptions.mCancelable); + e->SetTrusted(trusted); + e->mRequest = aOptions.mRequest.WasPassed() ? + &aOptions.mRequest.Value() : nullptr; + e->mIsReload = aOptions.mIsReload.WasPassed() ? + aOptions.mIsReload.Value() : false; + e->mClient = aOptions.mClient.WasPassed() ? + &aOptions.mClient.Value() : nullptr; + return e.forget(); +} + +namespace { + +class CancelChannelRunnable MOZ_FINAL : public nsRunnable +{ + nsMainThreadPtrHandle mChannel; +public: + explicit CancelChannelRunnable(nsMainThreadPtrHandle& aChannel) + : mChannel(aChannel) + { + } + + NS_IMETHOD Run() + { + MOZ_ASSERT(NS_IsMainThread()); + nsresult rv = mChannel->Cancel(); + NS_ENSURE_SUCCESS(rv, rv); + return NS_OK; + } +}; + +class FinishResponse MOZ_FINAL : public nsRunnable +{ + nsMainThreadPtrHandle mChannel; +public: + explicit FinishResponse(nsMainThreadPtrHandle& aChannel) + : mChannel(aChannel) + { + } + + NS_IMETHOD + Run() + { + AssertIsOnMainThread(); + nsresult rv = mChannel->FinishSynthesizedResponse(); + NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to finish synthesized response"); + return rv; + } +}; + +class RespondWithHandler MOZ_FINAL : public PromiseNativeHandler +{ + nsMainThreadPtrHandle mInterceptedChannel; + nsMainThreadPtrHandle mServiceWorker; +public: + RespondWithHandler(nsMainThreadPtrHandle& aChannel, + nsMainThreadPtrHandle& aServiceWorker) + : mInterceptedChannel(aChannel) + , mServiceWorker(aServiceWorker) + { + } + + void ResolvedCallback(JSContext* aCx, JS::Handle aValue) MOZ_OVERRIDE; + + void RejectedCallback(JSContext* aCx, JS::Handle aValue) MOZ_OVERRIDE; + + void CancelRequest(); +}; + +struct RespondWithClosure +{ + nsMainThreadPtrHandle mInterceptedChannel; + + explicit RespondWithClosure(nsMainThreadPtrHandle& aChannel) + : mInterceptedChannel(aChannel) + { + } +}; + +void RespondWithCopyComplete(void* aClosure, nsresult aStatus) +{ + nsAutoPtr data(static_cast(aClosure)); + nsCOMPtr event; + if (NS_SUCCEEDED(aStatus)) { + event = new FinishResponse(data->mInterceptedChannel); + } else { + event = new CancelChannelRunnable(data->mInterceptedChannel); + } + MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(event))); +} + +class MOZ_STACK_CLASS AutoCancel +{ + nsRefPtr mOwner; + +public: + explicit AutoCancel(RespondWithHandler* aOwner) + : mOwner(aOwner) + { + } + + ~AutoCancel() + { + if (mOwner) { + mOwner->CancelRequest(); + } + } + + void Reset() + { + mOwner = nullptr; + } +}; + +void +RespondWithHandler::ResolvedCallback(JSContext* aCx, JS::Handle aValue) +{ + AutoCancel autoCancel(this); + + if (!aValue.isObject()) { + return; + } + + nsRefPtr response; + nsresult rv = UNWRAP_OBJECT(Response, &aValue.toObject(), response); + if (NS_FAILED(rv)) { + return; + } + + nsCOMPtr body; + response->GetBody(getter_AddRefs(body)); + if (NS_WARN_IF(!body) || NS_WARN_IF(response->BodyUsed())) { + return; + } + response->SetBodyUsed(); + + nsCOMPtr responseBody; + rv = mInterceptedChannel->GetResponseBody(getter_AddRefs(responseBody)); + if (NS_WARN_IF(NS_FAILED(rv))) { + return; + } + + nsAutoPtr closure(new RespondWithClosure(mInterceptedChannel)); + + nsCOMPtr stsThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv); + if (NS_WARN_IF(!stsThread)) { + return; + } + rv = NS_AsyncCopy(body, responseBody, stsThread, NS_ASYNCCOPY_VIA_READSEGMENTS, 4096, + RespondWithCopyComplete, closure.forget()); + if (NS_WARN_IF(NS_FAILED(rv))) { + return; + } + + autoCancel.Reset(); +} + +void +RespondWithHandler::RejectedCallback(JSContext* aCx, JS::Handle aValue) +{ + CancelRequest(); +} + +void +RespondWithHandler::CancelRequest() +{ + nsCOMPtr runnable = new CancelChannelRunnable(mInterceptedChannel); + NS_DispatchToMainThread(runnable); +} + +} // anonymous namespace + +void +FetchEvent::RespondWith(Promise& aPromise, ErrorResult& aRv) +{ + if (mWaitToRespond) { + aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); + return; + } + + mWaitToRespond = true; + nsRefPtr handler = new RespondWithHandler(mChannel, mServiceWorker); + aPromise.AppendNativeHandler(handler); +} + +already_AddRefed +FetchEvent::Client() +{ + if (!mClient) { + mClient = new ServiceWorkerClient(GetParentObject(), mWindowId); + } + nsRefPtr client = mClient; + return client.forget(); +} + +already_AddRefed +FetchEvent::ForwardTo(const nsAString& aUrl) +{ + nsCOMPtr global = do_QueryInterface(GetParentObject()); + MOZ_ASSERT(global); + ErrorResult result; + nsRefPtr promise = Promise::Create(global, result); + if (NS_WARN_IF(result.Failed())) { + return nullptr; + } + + promise->MaybeReject(NS_ERROR_NOT_AVAILABLE); + return promise.forget(); +} + +already_AddRefed +FetchEvent::Default() +{ + nsCOMPtr global = do_QueryInterface(GetParentObject()); + MOZ_ASSERT(global); + ErrorResult result; + nsRefPtr promise = Promise::Create(global, result); + if (result.Failed()) { + return nullptr; + } + + promise->MaybeReject(NS_ERROR_NOT_AVAILABLE); + return promise.forget(); +} + +NS_IMPL_ADDREF_INHERITED(FetchEvent, Event) +NS_IMPL_RELEASE_INHERITED(FetchEvent, Event) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FetchEvent) +NS_INTERFACE_MAP_END_INHERITING(Event) + +NS_IMPL_CYCLE_COLLECTION_INHERITED(FetchEvent, Event, mRequest, mClient) + ExtendableEvent::ExtendableEvent(EventTarget* aOwner) : Event(aOwner, nullptr, nullptr) { diff --git a/dom/workers/ServiceWorkerEvents.h b/dom/workers/ServiceWorkerEvents.h index 04f30ccef88c..7a20cc87995c 100644 --- a/dom/workers/ServiceWorkerEvents.h +++ b/dom/workers/ServiceWorkerEvents.h @@ -8,12 +8,87 @@ #include "mozilla/dom/Event.h" #include "mozilla/dom/ExtendableEventBinding.h" +#include "mozilla/dom/FetchEventBinding.h" #include "mozilla/dom/InstallEventBinding.h" #include "mozilla/dom/Promise.h" +#include "nsProxyRelease.h" + +class nsIInterceptedChannel; + +namespace mozilla { +namespace dom { + class Request; +} // namespace dom +} // namespace mozilla BEGIN_WORKERS_NAMESPACE class ServiceWorker; +class ServiceWorkerClient; + +class FetchEvent MOZ_FINAL : public Event +{ + nsMainThreadPtrHandle mChannel; + nsMainThreadPtrHandle mServiceWorker; + nsRefPtr mClient; + nsRefPtr mRequest; + uint64_t mWindowId; + bool mIsReload; + bool mWaitToRespond; +protected: + explicit FetchEvent(EventTarget* aOwner); + ~FetchEvent(); + +public: + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FetchEvent, Event) + NS_FORWARD_TO_EVENT + + virtual JSObject* WrapObjectInternal(JSContext* aCx) MOZ_OVERRIDE + { + return FetchEventBinding::Wrap(aCx, this); + } + + void PostInit(nsMainThreadPtrHandle& aChannel, + nsMainThreadPtrHandle& aServiceWorker, + uint64_t aWindowId); + + static already_AddRefed + Constructor(const GlobalObject& aGlobal, + const nsAString& aType, + const FetchEventInit& aOptions, + ErrorResult& aRv); + + bool + WaitToRespond() const + { + return mWaitToRespond; + } + + Request* + Request_() const + { + return mRequest; + } + + already_AddRefed + Client(); + + bool + IsReload() const + { + return mIsReload; + } + + void + RespondWith(Promise& aPromise, ErrorResult& aRv); + + already_AddRefed + ForwardTo(const nsAString& aUrl); + + already_AddRefed + Default(); +}; class ExtendableEvent : public Event { diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp index c1dd85644f23..208a8144d055 100644 --- a/dom/workers/ServiceWorkerManager.cpp +++ b/dom/workers/ServiceWorkerManager.cpp @@ -11,7 +11,10 @@ #include "nsIStreamLoader.h" #include "nsIHttpChannel.h" #include "nsIHttpChannelInternal.h" +#include "nsIHttpHeaderVisitor.h" +#include "nsINetworkInterceptController.h" #include "nsPIDOMWindow.h" +#include "nsDebug.h" #include "jsapi.h" @@ -19,9 +22,13 @@ #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/DOMError.h" #include "mozilla/dom/ErrorEvent.h" +#include "mozilla/dom/Headers.h" #include "mozilla/dom/InstallEventBinding.h" +#include "mozilla/dom/InternalHeaders.h" #include "mozilla/dom/Navigator.h" #include "mozilla/dom/PromiseNativeHandler.h" +#include "mozilla/dom/Request.h" +#include "mozilla/dom/RootedDictionary.h" #include "mozilla/ipc/BackgroundChild.h" #include "mozilla/ipc/PBackgroundChild.h" #include "mozilla/ipc/PBackgroundSharedTypes.h" @@ -2121,6 +2128,267 @@ ServiceWorkerManager::GetServiceWorkerForScope(nsIDOMWindow* aWindow, return NS_OK; } +class FetchEventRunnable : public WorkerRunnable + , public nsIHttpHeaderVisitor { + nsMainThreadPtrHandle mInterceptedChannel; + nsMainThreadPtrHandle mServiceWorker; + nsTArray mHeaderNames; + nsTArray mHeaderValues; + uint64_t mWindowId; + nsCString mSpec; + nsCString mMethod; + bool mIsReload; +public: + FetchEventRunnable(WorkerPrivate* aWorkerPrivate, + nsMainThreadPtrHandle& aChannel, + nsMainThreadPtrHandle& aServiceWorker, + uint64_t aWindowId) + : WorkerRunnable(aWorkerPrivate, WorkerThreadModifyBusyCount) + , mInterceptedChannel(aChannel) + , mServiceWorker(aServiceWorker) + , mWindowId(aWindowId) + { + MOZ_ASSERT(aWorkerPrivate); + } + + NS_DECL_ISUPPORTS_INHERITED + + NS_IMETHOD + VisitHeader(const nsACString& aHeader, const nsACString& aValue) + { + mHeaderNames.AppendElement(aHeader); + mHeaderValues.AppendElement(aValue); + return NS_OK; + } + + nsresult + Init() + { + nsCOMPtr channel; + nsresult rv = mInterceptedChannel->GetChannel(getter_AddRefs(channel)); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr uri; + rv = channel->GetURI(getter_AddRefs(uri)); + NS_ENSURE_SUCCESS(rv, rv); + + rv = uri->GetSpec(mSpec); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr httpChannel = do_QueryInterface(channel); + NS_ENSURE_TRUE(httpChannel, NS_ERROR_NOT_AVAILABLE); + + rv = httpChannel->GetRequestMethod(mMethod); + NS_ENSURE_SUCCESS(rv, rv); + + uint32_t loadFlags; + rv = channel->GetLoadFlags(&loadFlags); + NS_ENSURE_SUCCESS(rv, rv); + + //TODO(jdm): we should probably include reload-ness in the loadinfo or as a separate load flag + mIsReload = false; + + rv = httpChannel->VisitRequestHeaders(this); + NS_ENSURE_SUCCESS(rv, rv); + + return NS_OK; + } + + bool + WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) + { + MOZ_ASSERT(aWorkerPrivate); + return DispatchFetchEvent(aCx, aWorkerPrivate); + } + +private: + ~FetchEventRunnable() {} + + class ResumeRequest MOZ_FINAL : public nsRunnable { + nsMainThreadPtrHandle mChannel; + public: + explicit ResumeRequest(nsMainThreadPtrHandle& aChannel) + : mChannel(aChannel) + { + } + + NS_IMETHOD Run() + { + AssertIsOnMainThread(); + nsresult rv = mChannel->ResetInterception(); + NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to resume intercepted network request"); + return rv; + } + }; + + bool + DispatchFetchEvent(JSContext* aCx, WorkerPrivate* aWorkerPrivate) + { + MOZ_ASSERT(aCx); + MOZ_ASSERT(aWorkerPrivate); + MOZ_ASSERT(aWorkerPrivate->IsServiceWorker()); + GlobalObject globalObj(aCx, aWorkerPrivate->GlobalScope()->GetWrapper()); + + RequestOrUSVString requestInfo; + *requestInfo.SetAsUSVString().ToAStringPtr() = NS_ConvertUTF8toUTF16(mSpec); + + RootedDictionary reqInit(aCx); + reqInit.mMethod.Construct(mMethod); + + nsRefPtr internalHeaders = new InternalHeaders(HeadersGuardEnum::Request); + MOZ_ASSERT(mHeaderNames.Length() == mHeaderValues.Length()); + for (uint32_t i = 0; i < mHeaderNames.Length(); i++) { + ErrorResult rv; + internalHeaders->Set(mHeaderNames[i], mHeaderValues[i], rv); + if (NS_WARN_IF(rv.Failed())) { + return false; + } + } + + nsRefPtr headers = new Headers(globalObj.GetAsSupports(), internalHeaders); + reqInit.mHeaders.Construct(); + reqInit.mHeaders.Value().SetAsHeaders() = headers; + + //TODO(jdm): set request body + //TODO(jdm): set request same-origin mode and credentials + + ErrorResult rv; + nsRefPtr request = Request::Constructor(globalObj, requestInfo, reqInit, rv); + if (NS_WARN_IF(rv.Failed())) { + return false; + } + + RootedDictionary init(aCx); + init.mRequest.Construct(); + init.mRequest.Value() = request; + init.mBubbles = false; + init.mCancelable = true; + init.mIsReload.Construct(mIsReload); + nsRefPtr event = + FetchEvent::Constructor(globalObj, NS_LITERAL_STRING("fetch"), init, rv); + if (NS_WARN_IF(rv.Failed())) { + return false; + } + + event->PostInit(mInterceptedChannel, mServiceWorker, mWindowId); + event->SetTrusted(true); + + nsRefPtr target = do_QueryObject(aWorkerPrivate->GlobalScope()); + nsresult rv2 = target->DispatchDOMEvent(nullptr, event, nullptr, nullptr); + if (NS_WARN_IF(NS_FAILED(rv2)) || !event->WaitToRespond()) { + nsCOMPtr runnable = new ResumeRequest(mInterceptedChannel); + MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable))); + } + return true; + } +}; + +NS_IMPL_ISUPPORTS_INHERITED(FetchEventRunnable, WorkerRunnable, nsIHttpHeaderVisitor) + +NS_IMETHODIMP +ServiceWorkerManager::DispatchFetchEvent(nsIDocument* aDoc, nsIInterceptedChannel* aChannel) +{ + MOZ_ASSERT(aChannel); + nsCOMPtr serviceWorker; + + bool isNavigation = false; + nsresult rv = aChannel->GetIsNavigation(&isNavigation); + NS_ENSURE_SUCCESS(rv, rv); + + if (!isNavigation) { + MOZ_ASSERT(aDoc); + rv = GetDocumentController(aDoc->GetWindow(), getter_AddRefs(serviceWorker)); + } else { + nsCOMPtr internalChannel; + rv = aChannel->GetChannel(getter_AddRefs(internalChannel)); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr uri; + rv = internalChannel->GetURI(getter_AddRefs(uri)); + NS_ENSURE_SUCCESS(rv, rv); + + nsRefPtr registration = + GetServiceWorkerRegistrationInfo(uri); + // This should only happen if IsAvailableForURI() returned true. + MOZ_ASSERT(registration); + MOZ_ASSERT(registration->mActiveWorker); + + nsRefPtr sw; + rv = CreateServiceWorker(registration->mPrincipal, + registration->mActiveWorker->ScriptSpec(), + registration->mScope, + getter_AddRefs(sw)); + serviceWorker = sw.forget(); + } + + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + + nsMainThreadPtrHandle handle( + new nsMainThreadPtrHolder(aChannel, false)); + + uint64_t windowId = aDoc ? aDoc->GetInnerWindow()->WindowID() : 0; + + nsRefPtr sw = static_cast(serviceWorker.get()); + nsMainThreadPtrHandle serviceWorkerHandle( + new nsMainThreadPtrHolder(sw)); + + nsRefPtr event = + new FetchEventRunnable(sw->GetWorkerPrivate(), handle, serviceWorkerHandle, windowId); + rv = event->Init(); + NS_ENSURE_SUCCESS(rv, rv); + + AutoJSAPI api; + api.Init(); + if (NS_WARN_IF(!event->Dispatch(api.cx()))) { + return NS_ERROR_FAILURE; + } + + return NS_OK; +} + +NS_IMETHODIMP +ServiceWorkerManager::IsAvailableForURI(nsIURI* aURI, bool* aIsAvailable) +{ + MOZ_ASSERT(aURI); + MOZ_ASSERT(aIsAvailable); + nsRefPtr registration = + GetServiceWorkerRegistrationInfo(aURI); + *aIsAvailable = registration && registration->mActiveWorker; + return NS_OK; +} + +NS_IMETHODIMP +ServiceWorkerManager::IsControlled(nsIDocument* aDoc, bool* aIsControlled) +{ + MOZ_ASSERT(aDoc); + MOZ_ASSERT(aIsControlled); + nsRefPtr registration; + nsresult rv = GetDocumentRegistration(aDoc, getter_AddRefs(registration)); + NS_ENSURE_SUCCESS(rv, rv); + *aIsControlled = !!registration; + return NS_OK; +} + +nsresult +ServiceWorkerManager::GetDocumentRegistration(nsIDocument* aDoc, + ServiceWorkerRegistrationInfo** aRegistrationInfo) +{ + nsRefPtr registration; + if (!mControlledDocuments.Get(aDoc, getter_AddRefs(registration))) { + return NS_ERROR_FAILURE; + } + + // If the document is controlled, the current worker MUST be non-null. + if (!registration->mActiveWorker) { + return NS_ERROR_NOT_AVAILABLE; + } + + registration.forget(aRegistrationInfo); + return NS_OK; +} + /* * The .controller is for the registration associated with the document when * the document was loaded. @@ -2137,21 +2405,16 @@ ServiceWorkerManager::GetDocumentController(nsIDOMWindow* aWindow, nsISupports** nsCOMPtr doc = window->GetExtantDoc(); nsRefPtr registration; - if (!mControlledDocuments.Get(doc, getter_AddRefs(registration))) { - return NS_ERROR_FAILURE; + nsresult rv = GetDocumentRegistration(doc, getter_AddRefs(registration)); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; } - // If the document is controlled, the current worker MUST be non-null. - if (!registration->mActiveWorker) { - return NS_ERROR_NOT_AVAILABLE; - } - - nsRefPtr serviceWorker; - nsresult rv = CreateServiceWorkerForWindow(window, - registration->mActiveWorker->ScriptSpec(), - registration->mScope, - getter_AddRefs(serviceWorker)); + rv = CreateServiceWorkerForWindow(window, + registration->mActiveWorker->ScriptSpec(), + registration->mScope, + getter_AddRefs(serviceWorker)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } diff --git a/dom/workers/ServiceWorkerManager.h b/dom/workers/ServiceWorkerManager.h index e642e08ed9c9..c5f8ff5c8b17 100644 --- a/dom/workers/ServiceWorkerManager.h +++ b/dom/workers/ServiceWorkerManager.h @@ -399,6 +399,9 @@ private: nsresult Update(ServiceWorkerRegistrationInfo* aRegistration); + nsresult + GetDocumentRegistration(nsIDocument* aDoc, ServiceWorkerRegistrationInfo** aRegistrationInfo); + NS_IMETHOD CreateServiceWorkerForWindow(nsPIDOMWindow* aWindow, const nsACString& aScriptSpec, diff --git a/dom/workers/test/serviceworkers/fetch/fetch_tests.js b/dom/workers/test/serviceworkers/fetch/fetch_tests.js new file mode 100644 index 000000000000..e6900b6860d3 --- /dev/null +++ b/dom/workers/test/serviceworkers/fetch/fetch_tests.js @@ -0,0 +1,54 @@ +function fetch(name, onload, onerror, headers) { + expectAsyncResult(); + + onload = onload || function() { + my_ok(false, "XHR load should not complete successfully"); + finish(); + }; + onerror = onerror || function() { + my_ok(false, "XHR load should be intercepted successfully"); + finish(); + }; + + var x = new XMLHttpRequest(); + x.open('GET', name, true); + x.onload = function() { onload(x) }; + x.onerror = function() { onerror(x) }; + headers = headers || []; + headers.forEach(function(header) { + x.setRequestHeader(header[0], header[1]); + }); + x.send(); +} + +fetch('synthesized.txt', function(xhr) { + my_ok(xhr.status == 200, "load should be successful"); + my_ok(xhr.responseText == "synthesized response body", "load should have synthesized response"); + finish(); +}); + +fetch('ignored.txt', function(xhr) { + my_ok(xhr.status == 404, "load should be uninterrupted"); + finish(); +}); + +fetch('rejected.txt', null, function(xhr) { + my_ok(xhr.status == 0, "load should not complete"); + finish(); +}); + +fetch('nonresponse.txt', null, function(xhr) { + my_ok(xhr.status == 0, "load should not complete"); + finish(); +}); + +fetch('nonresponse2.txt', null, function(xhr) { + my_ok(xhr.status == 0, "load should not complete"); + finish(); +}); + +fetch('headers.txt', function(xhr) { + my_ok(xhr.status == 200, "load should be successful"); + my_ok(xhr.responseText == "1", "request header checks should have passed"); + finish(); +}, null, [["X-Test1", "header1"], ["X-Test2", "header2"]]); diff --git a/dom/workers/test/serviceworkers/fetch/fetch_worker_script.js b/dom/workers/test/serviceworkers/fetch/fetch_worker_script.js new file mode 100644 index 000000000000..61efb647c8f9 --- /dev/null +++ b/dom/workers/test/serviceworkers/fetch/fetch_worker_script.js @@ -0,0 +1,29 @@ +function my_ok(v, msg) { + postMessage({type: "ok", value: v, msg: msg}); +} + +function finish() { + postMessage('finish'); +} + +function expectAsyncResult() { + postMessage('expect'); +} + +expectAsyncResult(); +try { + var success = false; + importScripts("nonexistent_imported_script.js"); +} catch(x) { +} + +my_ok(success, "worker imported script should be intercepted"); +finish(); + +function check_intercepted_script() { + success = true; +} + +importScripts('fetch_tests.js') + +finish(); //corresponds to the gExpected increment before creating this worker diff --git a/dom/workers/test/serviceworkers/fetch/index.html b/dom/workers/test/serviceworkers/fetch/index.html new file mode 100644 index 000000000000..88962f798956 --- /dev/null +++ b/dom/workers/test/serviceworkers/fetch/index.html @@ -0,0 +1,147 @@ + + + + + Bug 94048 - test install event. + + + + +

+ +
+

+
+
+
+
+
+
diff --git a/dom/workers/test/serviceworkers/fetch_event_worker.js b/dom/workers/test/serviceworkers/fetch_event_worker.js
new file mode 100644
index 000000000000..107544828397
--- /dev/null
+++ b/dom/workers/test/serviceworkers/fetch_event_worker.js
@@ -0,0 +1,86 @@
+onfetch = function(ev) {
+  if (ev.request.url.contains("synthesized.txt")) {
+    var p = new Promise(function(resolve) {
+      var r = new Response("synthesized response body", {});
+      resolve(r);
+    });
+    ev.respondWith(p);
+  }
+
+  else if (ev.request.url.contains("ignored.txt")) {
+  }
+
+  else if (ev.request.url.contains("rejected.txt")) {
+    var p = new Promise(function(resolve, reject) {
+      reject();
+    });
+    ev.respondWith(p);
+  }
+
+  else if (ev.request.url.contains("nonresponse.txt")) {
+    var p = new Promise(function(resolve, reject) {
+      resolve(5);
+    });
+    ev.respondWith(p);
+  }
+
+  else if (ev.request.url.contains("nonresponse2.txt")) {
+    var p = new Promise(function(resolve, reject) {
+      resolve({});
+    });
+    ev.respondWith(p);
+  }
+
+  else if (ev.request.url.contains("headers.txt")) {
+    var p = new Promise(function(resolve, reject) {
+      var ok = true;
+      ok &= ev.request.headers.get("X-Test1") == "header1";
+      ok &= ev.request.headers.get("X-Test2") == "header2";
+      var r = new Response(ok.toString(), {});
+      resolve(r);
+    });
+    ev.respondWith(p);    
+  }
+
+  else if (ev.request.url.contains("nonexistent_image.gif")) {
+    var p = new Promise(function(resolve, reject) {
+      resolve(new Response(atob("R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs"), {}));
+    });
+    ev.respondWith(p);
+  }
+
+  else if (ev.request.url.contains("nonexistent_script.js")) {
+    var p = new Promise(function(resolve, reject) {
+      resolve(new Response("check_intercepted_script();", {}));
+    });
+    ev.respondWith(p);
+  }
+
+  else if (ev.request.url.contains("nonexistent_stylesheet.css")) {
+    var p = new Promise(function(resolve, reject) {
+      resolve(new Response("#style-test { background-color: black !important; }", {}));
+    });
+    ev.respondWith(p);
+  }
+
+  else if (ev.request.url.contains("nonexistent_page.html")) {
+    var p = new Promise(function(resolve, reject) {
+      resolve(new Response("", {}));
+    });
+    ev.respondWith(p);
+  }
+
+  else if (ev.request.url.contains("nonexistent_worker_script.js")) {
+    var p = new Promise(function(resolve, reject) {
+      resolve(new Response("postMessage('worker-intercept-success')", {}));
+    });
+    ev.respondWith(p);
+  }
+
+  else if (ev.request.url.contains("nonexistent_imported_script.js")) {
+    var p = new Promise(function(resolve, reject) {
+      resolve(new Response("check_intercepted_script();", {}));
+    });
+    ev.respondWith(p);
+  }
+}
diff --git a/dom/workers/test/serviceworkers/mochitest.ini b/dom/workers/test/serviceworkers/mochitest.ini
index edc7d06c7420..074cba12d1d7 100644
--- a/dom/workers/test/serviceworkers/mochitest.ini
+++ b/dom/workers/test/serviceworkers/mochitest.ini
@@ -4,6 +4,7 @@ support-files =
   worker.js
   worker2.js
   worker3.js
+  fetch_event_worker.js
   parse_error_worker.js
   activate_event_error_worker.js
   install_event_worker.js
@@ -20,10 +21,14 @@ support-files =
   worker_unregister.js
   worker_update.js
   message_posting_worker.js
+  fetch/index.html
+  fetch/fetch_worker_script.js
+  fetch/fetch_tests.js
 
 [test_unregister.html]
 skip-if = true # Bug 1133805
 [test_installation_simple.html]
+[test_fetch_event.html]
 [test_get_serviced.html]
 [test_install_event.html]
 [test_navigator.html]
diff --git a/dom/workers/test/serviceworkers/test_fetch_event.html b/dom/workers/test/serviceworkers/test_fetch_event.html
new file mode 100644
index 000000000000..090e6e4faf68
--- /dev/null
+++ b/dom/workers/test/serviceworkers/test_fetch_event.html
@@ -0,0 +1,61 @@
+
+
+
+
+  Bug 94048 - test install event.
+  
+  
+
+
+

+ +

+
+
+
+
+
diff --git a/netwerk/base/nsINetworkInterceptController.idl b/netwerk/base/nsINetworkInterceptController.idl
index 766e2cd9266a..576082c24557 100644
--- a/netwerk/base/nsINetworkInterceptController.idl
+++ b/netwerk/base/nsINetworkInterceptController.idl
@@ -5,7 +5,7 @@
 
 #include "nsISupports.idl"
 
-interface nsIHttpChannelInternal;
+interface nsIChannel;
 interface nsIOutputStream;
 interface nsIURI;
 
@@ -16,7 +16,7 @@ interface nsIURI;
  * which do not implement nsIChannel.
  */
 
-[scriptable, uuid(0b5f82a7-5824-4a0d-bf5c-8a8a7684c0c8)]
+[scriptable, uuid(9d127b63-dfad-484d-a0e1-cb82697a095b)]
 interface nsIInterceptedChannel : nsISupports
 {
     /**
@@ -37,6 +37,28 @@ interface nsIInterceptedChannel : nsISupports
      * after this point.
      */
     void finishSynthesizedResponse();
+
+    /**
+     * Cancel the pending intercepted request.
+     * @return NS_ERROR_FAILURE if the response has already been synthesized or
+     *         the original request has been instructed to continue.
+     */
+    void cancel();
+
+    /**
+     * The synthesized response body to be produced.
+     */
+    readonly attribute nsIOutputStream responseBody;
+
+    /**
+     * The underlying channel object that was intercepted.
+     */
+    readonly attribute nsIChannel channel;
+
+    /**
+     * True if the underlying request was caused by a navigation attempt.
+     */
+    readonly attribute bool isNavigation;
 };
 
 /**
@@ -45,7 +67,7 @@ interface nsIInterceptedChannel : nsISupports
  * request should be intercepted before any network request is initiated.
  */
 
-[scriptable, uuid(b3ad3e9b-91d8-44d0-a0c5-dc2e9374f599)]
+[scriptable, uuid(69150b77-b561-43a2-bfba-7301dd5a35d0)]
 interface nsINetworkInterceptController : nsISupports
 {
     /**
@@ -53,15 +75,15 @@ interface nsINetworkInterceptController : nsISupports
      * requests until specifically instructed to do so.
      *
      * @param aURI the URI being requested by a channel
+     * @param aIsNavigate True if the request is for a navigation, false for a fetch.
      */
-    bool shouldPrepareForIntercept(in nsIURI aURI);
+    bool shouldPrepareForIntercept(in nsIURI aURI, in bool aIsNavigate);
 
     /**
      * Notification when a given intercepted channel is prepared to accept a synthesized
      * response via the provided stream.
      *
      * @param aChannel the controlling interface for a channel that has been intercepted
-     * @param aStream a stream directly into the channel's synthesized response body
      */
-    void channelIntercepted(in nsIInterceptedChannel aChannel, in nsIOutputStream aStream);
+    void channelIntercepted(in nsIInterceptedChannel aChannel);
 };
diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp
index a8786f2c6ed6..69a3594179e0 100644
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -1933,6 +1933,12 @@ HttpBaseChannel::GetURIPrincipal()
   return mPrincipal;
 }
 
+bool
+HttpBaseChannel::IsNavigation()
+{
+  return mLoadFlags & LOAD_DOCUMENT_URI;
+}
+
 bool
 HttpBaseChannel::ShouldIntercept()
 {
@@ -1940,7 +1946,9 @@ HttpBaseChannel::ShouldIntercept()
   GetCallback(controller);
   bool shouldIntercept = false;
   if (controller && !mForceNoIntercept) {
-    nsresult rv = controller->ShouldPrepareForIntercept(mURI, &shouldIntercept);
+    nsresult rv = controller->ShouldPrepareForIntercept(mURI,
+                                                        IsNavigation(),
+                                                        &shouldIntercept);
     NS_ENSURE_SUCCESS(rv, false);
   }
   return shouldIntercept;
diff --git a/netwerk/protocol/http/HttpBaseChannel.h b/netwerk/protocol/http/HttpBaseChannel.h
index a26bc2df96e6..de7d0ba26553 100644
--- a/netwerk/protocol/http/HttpBaseChannel.h
+++ b/netwerk/protocol/http/HttpBaseChannel.h
@@ -241,7 +241,7 @@ public:
     const NetAddr& GetPeerAddr() { return mPeerAddr; }
 
 public: /* Necko internal use only... */
-
+    bool IsNavigation();
 
     // Return whether upon a redirect code of httpStatus for method, the
     // request method should be rewritten to GET.
diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp
index 741d0e4ae007..944894343dac 100644
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -56,6 +56,111 @@ static_assert(FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE == 250,
 
 }
 
+// A stream listener interposed between the nsInputStreamPump used for intercepted channels
+// and this channel's original listener. This is only used to ensure the original listener
+// sees the channel as the request object, and to synthesize OnStatus and OnProgress notifications.
+class InterceptStreamListener : public nsIStreamListener
+                              , public nsIProgressEventSink
+{
+  nsRefPtr mOwner;
+  nsCOMPtr mContext;
+  virtual ~InterceptStreamListener() {}
+ public:
+  InterceptStreamListener(HttpChannelChild* aOwner, nsISupports* aContext)
+  : mOwner(aOwner)
+  , mContext(aContext)
+  {
+  }
+
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIREQUESTOBSERVER
+  NS_DECL_NSISTREAMLISTENER
+  NS_DECL_NSIPROGRESSEVENTSINK
+
+  void Cleanup();
+};
+
+NS_IMPL_ISUPPORTS(InterceptStreamListener,
+                  nsIStreamListener,
+                  nsIRequestObserver,
+                  nsIProgressEventSink)
+
+NS_IMETHODIMP
+InterceptStreamListener::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
+{
+  if (mOwner) {
+    mOwner->DoOnStartRequest(mOwner, mContext);
+  }
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+InterceptStreamListener::OnStatus(nsIRequest* aRequest, nsISupports* aContext,
+                                  nsresult status, const char16_t* aStatusArg)
+{
+  if (mOwner) {
+    mOwner->DoOnStatus(mOwner, status);
+  }
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+InterceptStreamListener::OnProgress(nsIRequest* aRequest, nsISupports* aContext,
+                                    int64_t aProgress, int64_t aProgressMax)
+{
+  if (mOwner) {
+    mOwner->DoOnProgress(mOwner, aProgress, aProgressMax);
+  }
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+InterceptStreamListener::OnDataAvailable(nsIRequest* aRequest, nsISupports* aContext,
+                                         nsIInputStream* aInputStream, uint64_t aOffset,
+                                         uint32_t aCount)
+{
+  if (!mOwner) {
+    return NS_OK;
+  }
+
+  uint32_t loadFlags;
+  mOwner->GetLoadFlags(&loadFlags);
+
+  if (!(loadFlags & HttpBaseChannel::LOAD_BACKGROUND)) {
+    nsCOMPtr uri;
+    mOwner->GetURI(getter_AddRefs(uri));
+
+    nsAutoCString host;
+    uri->GetHost(host);
+
+    OnStatus(mOwner, aContext, NS_NET_STATUS_READING, NS_ConvertUTF8toUTF16(host).get());
+
+    int64_t progress = aOffset + aCount;
+    OnProgress(mOwner, aContext, progress, mOwner->GetResponseHead()->ContentLength());
+  }
+
+  mOwner->DoOnDataAvailable(mOwner, mContext, aInputStream, aOffset, aCount);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+InterceptStreamListener::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext, nsresult aStatusCode)
+{
+  if (mOwner) {
+    mOwner->DoPreOnStopRequest(aStatusCode);
+    mOwner->DoOnStopRequest(mOwner, mContext);
+  }
+  Cleanup();
+  return NS_OK;
+}
+
+void
+InterceptStreamListener::Cleanup()
+{
+  mOwner = nullptr;
+  mContext = nullptr;
+}
+
 //-----------------------------------------------------------------------------
 // HttpChannelChild
 //-----------------------------------------------------------------------------
@@ -852,6 +957,10 @@ HttpChannelChild::DoNotifyListenerCleanup()
   LOG(("HttpChannelChild::DoNotifyListenerCleanup [this=%p]\n", this));
   if (mIPCOpen)
     PHttpChannelChild::Send__delete__(this);
+  if (mInterceptListener) {
+    mInterceptListener->Cleanup();
+    mInterceptListener = nullptr;
+  }
 }
 
 class DeleteSelfEvent : public ChannelEvent
@@ -1237,6 +1346,10 @@ HttpChannelChild::Cancel(nsresult status)
     mStatus = status;
     if (RemoteChannelExists())
       SendCancel(status);
+    if (mSynthesizedResponsePump) {
+      mSynthesizedResponsePump->Cancel(status);
+    }
+    mInterceptListener = nullptr;
   }
   return NS_OK;
 }
@@ -1343,89 +1456,6 @@ HttpChannelChild::GetSecurityInfo(nsISupports **aSecurityInfo)
   return NS_OK;
 }
 
-// A stream listener interposed between the nsInputStreamPump used for intercepted channels
-// and this channel's original listener. This is only used to ensure the original listener
-// sees the channel as the request object, and to synthesize OnStatus and OnProgress notifications.
-class InterceptStreamListener : public nsIStreamListener
-                              , public nsIProgressEventSink
-{
-  nsRefPtr mOwner;
-  nsCOMPtr mContext;
-  virtual ~InterceptStreamListener() {}
-public:
-  InterceptStreamListener(HttpChannelChild* aOwner, nsISupports* aContext)
-  : mOwner(aOwner)
-  , mContext(aContext)
-  {
-  }
-
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIREQUESTOBSERVER
-  NS_DECL_NSISTREAMLISTENER
-  NS_DECL_NSIPROGRESSEVENTSINK
-};
-
-NS_IMPL_ISUPPORTS(InterceptStreamListener,
-                  nsIStreamListener,
-                  nsIRequestObserver,
-                  nsIProgressEventSink)
-
-NS_IMETHODIMP
-InterceptStreamListener::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
-{
-  mOwner->DoOnStartRequest(mOwner, mContext);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-InterceptStreamListener::OnStatus(nsIRequest* aRequest, nsISupports* aContext,
-                                  nsresult status, const char16_t* aStatusArg)
-{
-  mOwner->DoOnStatus(mOwner, status);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-InterceptStreamListener::OnProgress(nsIRequest* aRequest, nsISupports* aContext,
-                                    int64_t aProgress, int64_t aProgressMax)
-{
-  mOwner->DoOnProgress(mOwner, aProgress, aProgressMax);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-InterceptStreamListener::OnDataAvailable(nsIRequest* aRequest, nsISupports* aContext,
-                                         nsIInputStream* aInputStream, uint64_t aOffset,
-                                         uint32_t aCount)
-{
-  uint32_t loadFlags;
-  mOwner->GetLoadFlags(&loadFlags);
-
-  if (!(loadFlags & HttpBaseChannel::LOAD_BACKGROUND)) {
-    nsCOMPtr uri;
-    mOwner->GetURI(getter_AddRefs(uri));
-
-    nsAutoCString host;
-    uri->GetHost(host);
-
-    OnStatus(mOwner, aContext, NS_NET_STATUS_READING, NS_ConvertUTF8toUTF16(host).get());
-
-    int64_t progress = aOffset + aCount;
-    OnProgress(mOwner, aContext, progress, mOwner->GetResponseHead()->ContentLength());
-  }
-
-  mOwner->DoOnDataAvailable(mOwner, mContext, aInputStream, aOffset, aCount);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-InterceptStreamListener::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext, nsresult aStatusCode)
-{
-  mOwner->DoPreOnStopRequest(aStatusCode);
-  mOwner->DoOnStopRequest(mOwner, mContext);
-  return NS_OK;
-}
-
 NS_IMETHODIMP
 HttpChannelChild::AsyncOpen(nsIStreamListener *listener, nsISupports *aContext)
 {
@@ -2043,6 +2073,7 @@ HttpChannelChild::DivertToParent(ChannelDiverterChild **aChild)
 void
 HttpChannelChild::ResetInterception()
 {
+  mInterceptListener->Cleanup();
   mInterceptListener = nullptr;
 
   // Continue with the original cross-process request
@@ -2051,7 +2082,7 @@ HttpChannelChild::ResetInterception()
 }
 
 void
-HttpChannelChild::OverrideWithSynthesizedResponse(nsHttpResponseHead* aResponseHead,
+HttpChannelChild::OverrideWithSynthesizedResponse(nsAutoPtr& aResponseHead,
                                                   nsInputStreamPump* aPump)
 {
   mSynthesizedResponsePump = aPump;
@@ -2063,6 +2094,10 @@ HttpChannelChild::OverrideWithSynthesizedResponse(nsHttpResponseHead* aResponseH
     nsresult rv = mSynthesizedResponsePump->Suspend();
     NS_ENSURE_SUCCESS_VOID(rv);
   }
+
+  if (mCanceled) {
+    mSynthesizedResponsePump->Cancel(mStatus);
+  }
 }
 
 }} // mozilla::net
diff --git a/netwerk/protocol/http/HttpChannelChild.h b/netwerk/protocol/http/HttpChannelChild.h
index 53857a54169a..4bca9eaa1282 100644
--- a/netwerk/protocol/http/HttpChannelChild.h
+++ b/netwerk/protocol/http/HttpChannelChild.h
@@ -159,7 +159,7 @@ private:
 
   // Override this channel's pending response with a synthesized one. The content will be
   // asynchronously read from the pump.
-  void OverrideWithSynthesizedResponse(nsHttpResponseHead* aResponseHead, nsInputStreamPump* aPump);
+  void OverrideWithSynthesizedResponse(nsAutoPtr& aResponseHead, nsInputStreamPump* aPump);
 
   RequestHeaderTuples mClientSetRequestHeaders;
   nsCOMPtr mRedirectChannelChild;
diff --git a/netwerk/protocol/http/InterceptedChannel.cpp b/netwerk/protocol/http/InterceptedChannel.cpp
index 7f5f8e38ad14..9cc4ead8b476 100644
--- a/netwerk/protocol/http/InterceptedChannel.cpp
+++ b/netwerk/protocol/http/InterceptedChannel.cpp
@@ -26,8 +26,10 @@ DoAddCacheEntryHeaders(nsHttpChannel *self,
 
 NS_IMPL_ISUPPORTS(InterceptedChannelBase, nsIInterceptedChannel)
 
-InterceptedChannelBase::InterceptedChannelBase(nsINetworkInterceptController* aController)
+InterceptedChannelBase::InterceptedChannelBase(nsINetworkInterceptController* aController,
+                                               bool aIsNavigation)
 : mController(aController)
+, mIsNavigation(aIsNavigation)
 {
 }
 
@@ -35,21 +37,36 @@ InterceptedChannelBase::~InterceptedChannelBase()
 {
 }
 
+NS_IMETHODIMP
+InterceptedChannelBase::GetResponseBody(nsIOutputStream** aStream)
+{
+  NS_IF_ADDREF(*aStream = mResponseBody);
+  return NS_OK;
+}
+
 void
 InterceptedChannelBase::EnsureSynthesizedResponse()
 {
   if (mSynthesizedResponseHead.isNothing()) {
-    mSynthesizedResponseHead.emplace();
+    mSynthesizedResponseHead.emplace(new nsHttpResponseHead());
   }
 }
 
 void
-InterceptedChannelBase::DoNotifyController(nsIOutputStream* aOut)
+InterceptedChannelBase::DoNotifyController()
 {
-    nsresult rv = mController->ChannelIntercepted(this, aOut);
+    nsresult rv = mController->ChannelIntercepted(this);
+    mController = nullptr;
     NS_ENSURE_SUCCESS_VOID(rv);
 }
 
+NS_IMETHODIMP
+InterceptedChannelBase::GetIsNavigation(bool* aIsNavigation)
+{
+  *aIsNavigation = mIsNavigation;
+  return NS_OK;
+}
+
 nsresult
 InterceptedChannelBase::DoSynthesizeHeader(const nsACString& aName, const nsACString& aValue)
 {
@@ -57,7 +74,7 @@ InterceptedChannelBase::DoSynthesizeHeader(const nsACString& aName, const nsACSt
 
     nsAutoCString header = aName + NS_LITERAL_CSTRING(": ") + aValue;
     // Overwrite any existing header.
-    nsresult rv = mSynthesizedResponseHead->ParseHeaderLine(header.get());
+    nsresult rv = (*mSynthesizedResponseHead)->ParseHeaderLine(header.get());
     NS_ENSURE_SUCCESS(rv, rv);
     return NS_OK;
 }
@@ -65,7 +82,7 @@ InterceptedChannelBase::DoSynthesizeHeader(const nsACString& aName, const nsACSt
 InterceptedChannelChrome::InterceptedChannelChrome(nsHttpChannel* aChannel,
                                                    nsINetworkInterceptController* aController,
                                                    nsICacheEntry* aEntry)
-: InterceptedChannelBase(aController)
+: InterceptedChannelBase(aController, aChannel->IsNavigation())
 , mChannel(aChannel)
 , mSynthesizedCacheEntry(aEntry)
 {
@@ -76,10 +93,17 @@ InterceptedChannelChrome::NotifyController()
 {
   nsCOMPtr out;
 
-  nsresult rv = mSynthesizedCacheEntry->OpenOutputStream(0, getter_AddRefs(out));
+  nsresult rv = mSynthesizedCacheEntry->OpenOutputStream(0, getter_AddRefs(mResponseBody));
   NS_ENSURE_SUCCESS_VOID(rv);
 
-  DoNotifyController(out);
+  DoNotifyController();
+}
+
+NS_IMETHODIMP
+InterceptedChannelChrome::GetChannel(nsIChannel** aChannel)
+{
+  NS_IF_ADDREF(*aChannel = mChannel);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -132,7 +156,7 @@ InterceptedChannelChrome::FinishSynthesizedResponse()
 
   rv = DoAddCacheEntryHeaders(mChannel, mSynthesizedCacheEntry,
                               mChannel->GetRequestHead(),
-                              mSynthesizedResponseHead.ptr(), securityInfo);
+                              mSynthesizedResponseHead.ref(), securityInfo);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr uri;
@@ -156,10 +180,24 @@ InterceptedChannelChrome::FinishSynthesizedResponse()
   return NS_OK;
 }
 
+NS_IMETHODIMP
+InterceptedChannelChrome::Cancel()
+{
+  if (!mChannel) {
+    return NS_ERROR_FAILURE;
+  }
+
+  // we need to use AsyncAbort instead of Cancel since there's no active pump
+  // to cancel which will provide OnStart/OnStopRequest to the channel.
+  nsresult rv = mChannel->AsyncAbort(NS_BINDING_ABORTED);
+  NS_ENSURE_SUCCESS(rv, rv);
+  return NS_OK;
+}
+
 InterceptedChannelContent::InterceptedChannelContent(HttpChannelChild* aChannel,
                                                      nsINetworkInterceptController* aController,
                                                      nsIStreamListener* aListener)
-: InterceptedChannelBase(aController)
+: InterceptedChannelBase(aController, aChannel->IsNavigation())
 , mChannel(aChannel)
 , mStreamListener(aListener)
 {
@@ -169,11 +207,18 @@ void
 InterceptedChannelContent::NotifyController()
 {
   nsresult rv = NS_NewPipe(getter_AddRefs(mSynthesizedInput),
-                           getter_AddRefs(mSynthesizedOutput),
+                           getter_AddRefs(mResponseBody),
                            0, UINT32_MAX, true, true);
   NS_ENSURE_SUCCESS_VOID(rv);
 
-  DoNotifyController(mSynthesizedOutput);
+  DoNotifyController();
+}
+
+NS_IMETHODIMP
+InterceptedChannelContent::GetChannel(nsIChannel** aChannel)
+{
+  NS_IF_ADDREF(*aChannel = mChannel);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -183,7 +228,7 @@ InterceptedChannelContent::ResetInterception()
     return NS_ERROR_NOT_AVAILABLE;
   }
 
-  mSynthesizedOutput = nullptr;
+  mResponseBody = nullptr;
   mSynthesizedInput = nullptr;
 
   mChannel->ResetInterception();
@@ -194,7 +239,7 @@ InterceptedChannelContent::ResetInterception()
 NS_IMETHODIMP
 InterceptedChannelContent::SynthesizeHeader(const nsACString& aName, const nsACString& aValue)
 {
-  if (!mSynthesizedOutput) {
+  if (!mResponseBody) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
@@ -204,7 +249,7 @@ InterceptedChannelContent::SynthesizeHeader(const nsACString& aName, const nsACS
 NS_IMETHODIMP
 InterceptedChannelContent::FinishSynthesizedResponse()
 {
-  if (!mChannel) {
+  if (NS_WARN_IF(!mChannel)) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
@@ -212,19 +257,36 @@ InterceptedChannelContent::FinishSynthesizedResponse()
 
   nsresult rv = nsInputStreamPump::Create(getter_AddRefs(mStoragePump), mSynthesizedInput,
                                           int64_t(-1), int64_t(-1), 0, 0, true);
-  if (NS_FAILED(rv)) {
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     mSynthesizedInput->Close();
     return rv;
   }
 
-  mSynthesizedOutput = nullptr;
+  mResponseBody = nullptr;
 
   rv = mStoragePump->AsyncRead(mStreamListener, nullptr);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  mChannel->OverrideWithSynthesizedResponse(mSynthesizedResponseHead.ptr(), mStoragePump);
+  mChannel->OverrideWithSynthesizedResponse(mSynthesizedResponseHead.ref(), mStoragePump);
 
   mChannel = nullptr;
+  mStreamListener = nullptr;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+InterceptedChannelContent::Cancel()
+{
+  if (!mChannel) {
+    return NS_ERROR_FAILURE;
+  }
+
+  // we need to use AsyncAbort instead of Cancel since there's no active pump
+  // to cancel which will provide OnStart/OnStopRequest to the channel.
+  nsresult rv = mChannel->AsyncAbort(NS_BINDING_ABORTED);
+  NS_ENSURE_SUCCESS(rv, rv);
+  mChannel = nullptr;
+  mStreamListener = nullptr;
   return NS_OK;
 }
 
diff --git a/netwerk/protocol/http/InterceptedChannel.h b/netwerk/protocol/http/InterceptedChannel.h
index 695f5d5befa3..30da2551216a 100644
--- a/netwerk/protocol/http/InterceptedChannel.h
+++ b/netwerk/protocol/http/InterceptedChannel.h
@@ -30,22 +30,32 @@ protected:
   // The interception controller to notify about the successful channel interception
   nsCOMPtr mController;
 
+  // The stream to write the body of the synthesized response
+  nsCOMPtr mResponseBody;
+
   // Response head for use when synthesizing
-  Maybe mSynthesizedResponseHead;
+  Maybe> mSynthesizedResponseHead;
+
+  // Whether this intercepted channel was performing a navigation.
+  bool mIsNavigation;
 
   void EnsureSynthesizedResponse();
-  void DoNotifyController(nsIOutputStream* aOut);
+  void DoNotifyController();
   nsresult DoSynthesizeHeader(const nsACString& aName, const nsACString& aValue);
 
   virtual ~InterceptedChannelBase();
 public:
-  explicit InterceptedChannelBase(nsINetworkInterceptController* aController);
+  InterceptedChannelBase(nsINetworkInterceptController* aController,
+                         bool aIsNavigation);
 
   // Notify the interception controller that the channel has been intercepted
   // and prepare the response body output stream.
   virtual void NotifyController() = 0;
 
   NS_DECL_ISUPPORTS
+
+  NS_IMETHOD GetResponseBody(nsIOutputStream** aOutput) MOZ_OVERRIDE;
+  NS_IMETHOD GetIsNavigation(bool* aIsNavigation) MOZ_OVERRIDE;
 };
 
 class InterceptedChannelChrome : public InterceptedChannelBase
@@ -60,7 +70,11 @@ public:
                            nsINetworkInterceptController* aController,
                            nsICacheEntry* aEntry);
 
-  NS_DECL_NSIINTERCEPTEDCHANNEL
+  NS_IMETHOD ResetInterception() MOZ_OVERRIDE;
+  NS_IMETHOD FinishSynthesizedResponse() MOZ_OVERRIDE;
+  NS_IMETHOD GetChannel(nsIChannel** aChannel) MOZ_OVERRIDE;
+  NS_IMETHOD SynthesizeHeader(const nsACString& aName, const nsACString& aValue) MOZ_OVERRIDE;
+  NS_IMETHOD Cancel() MOZ_OVERRIDE;
 
   virtual void NotifyController() MOZ_OVERRIDE;
 };
@@ -70,8 +84,7 @@ class InterceptedChannelContent : public InterceptedChannelBase
   // The actual channel being intercepted.
   nsRefPtr mChannel;
 
-  // Writeable buffer for use when synthesizing a response in a child process
-  nsCOMPtr mSynthesizedOutput;
+  // Reader-side of the response body when synthesizing in a child proces
   nsCOMPtr mSynthesizedInput;
 
   // Pump to read the synthesized body in child processes
@@ -85,7 +98,11 @@ public:
                             nsINetworkInterceptController* aController,
                             nsIStreamListener* aListener);
 
-  NS_DECL_NSIINTERCEPTEDCHANNEL
+  NS_IMETHOD ResetInterception() MOZ_OVERRIDE;
+  NS_IMETHOD FinishSynthesizedResponse() MOZ_OVERRIDE;
+  NS_IMETHOD GetChannel(nsIChannel** aChannel) MOZ_OVERRIDE;
+  NS_IMETHOD SynthesizeHeader(const nsACString& aName, const nsACString& aValue) MOZ_OVERRIDE;
+  NS_IMETHOD Cancel() MOZ_OVERRIDE;
 
   virtual void NotifyController() MOZ_OVERRIDE;
 };
diff --git a/netwerk/test/unit/test_synthesized_response.js b/netwerk/test/unit/test_synthesized_response.js
index 00d489387aa8..47b70f1b8061 100644
--- a/netwerk/test/unit/test_synthesized_response.js
+++ b/netwerk/test/unit/test_synthesized_response.js
@@ -55,19 +55,19 @@ function make_channel(url, body, cb) {
       this.numChecks++;
       return true;
     },
-    channelIntercepted: function(channel, stream) {
+    channelIntercepted: function(channel) {
       channel.QueryInterface(Ci.nsIInterceptedChannel);
       if (body) {
         var synthesized = Cc["@mozilla.org/io/string-input-stream;1"]
                             .createInstance(Ci.nsIStringInputStream);
         synthesized.data = body;
 
-        NetUtil.asyncCopy(synthesized, stream, function() {
+        NetUtil.asyncCopy(synthesized, channel.responseBody, function() {
           channel.finishSynthesizedResponse();
         });
       }
       if (cb) {
-        cb(channel, stream);
+        cb(channel);
       }
     },
   };
@@ -143,12 +143,12 @@ add_test(function() {
 
 // ensure that the channel waits for a decision and synthesizes headers correctly
 add_test(function() {
-  var chan = make_channel(URL + '/body', null, function(channel, stream) {
+  var chan = make_channel(URL + '/body', null, function(channel) {
     do_timeout(100, function() {
       var synthesized = Cc["@mozilla.org/io/string-input-stream;1"]
                           .createInstance(Ci.nsIStringInputStream);
       synthesized.data = NON_REMOTE_BODY;
-      NetUtil.asyncCopy(synthesized, stream, function() {
+      NetUtil.asyncCopy(synthesized, channel.responseBody, function() {
         channel.synthesizeHeader("Content-Length", NON_REMOTE_BODY.length);
         channel.finishSynthesizedResponse();
       });
@@ -169,12 +169,12 @@ add_test(function() {
 
 // ensure that the intercepted channel supports suspend/resume
 add_test(function() {
-  var chan = make_channel(URL + '/body', null, function(intercepted, stream) {
+  var chan = make_channel(URL + '/body', null, function(intercepted) {
     var synthesized = Cc["@mozilla.org/io/string-input-stream;1"]
                         .createInstance(Ci.nsIStringInputStream);
     synthesized.data = NON_REMOTE_BODY;
 
-    NetUtil.asyncCopy(synthesized, stream, function() {
+    NetUtil.asyncCopy(synthesized, intercepted.responseBody, function() {
       // set the content-type to ensure that the stream converter doesn't hold up notifications
       // and cause the test to fail
       intercepted.synthesizeHeader("Content-Type", "text/plain");
@@ -185,6 +185,65 @@ add_test(function() {
 				     CL_ALLOW_UNKNOWN_CL | CL_SUSPEND | CL_EXPECT_3S_DELAY), null);
 });
 
+// ensure that the intercepted channel can be cancelled
+add_test(function() {
+  var chan = make_channel(URL + '/body', null, function(intercepted) {
+    intercepted.cancel();
+  });
+  chan.asyncOpen(new ChannelListener(run_next_test, null,
+				     CL_EXPECT_FAILURE), null);
+});
+
+// ensure that the channel can't be cancelled via nsIInterceptedChannel after making a decision
+add_test(function() {
+  var chan = make_channel(URL + '/body', null, function(chan) {
+    chan.resetInterception();
+    do_timeout(0, function() {
+      var gotexception = false;
+      try {
+        chan.cancel();
+      } catch (x) {
+        gotexception = true;
+      }
+      do_check_true(gotexception);
+    });
+  });
+  chan.asyncOpen(new ChannelListener(handle_remote_response, null), null);
+});
+
+// ensure that the intercepted channel can be canceled during the response
+add_test(function() {
+  var chan = make_channel(URL + '/body', null, function(intercepted) {
+    var synthesized = Cc["@mozilla.org/io/string-input-stream;1"]
+                        .createInstance(Ci.nsIStringInputStream);
+    synthesized.data = NON_REMOTE_BODY;
+
+    NetUtil.asyncCopy(synthesized, intercepted.responseBody, function() {
+      let channel = intercepted.channel;
+      intercepted.finishSynthesizedResponse();
+      channel.cancel(Cr.NS_BINDING_ABORTED);
+    });
+  });
+  chan.asyncOpen(new ChannelListener(run_next_test, null,
+                                     CL_EXPECT_FAILURE | CL_ALLOW_UNKNOWN_CL), null);
+});
+
+// ensure that the intercepted channel can be canceled before the response
+add_test(function() {
+  var chan = make_channel(URL + '/body', null, function(intercepted) {
+    var synthesized = Cc["@mozilla.org/io/string-input-stream;1"]
+                        .createInstance(Ci.nsIStringInputStream);
+    synthesized.data = NON_REMOTE_BODY;
+
+    NetUtil.asyncCopy(synthesized, intercepted.responseBody, function() {
+      intercepted.channel.cancel(Cr.NS_BINDING_ABORTED);
+      intercepted.finishSynthesizedResponse();
+    });
+  });
+  chan.asyncOpen(new ChannelListener(run_next_test, null,
+                                     CL_EXPECT_FAILURE | CL_ALLOW_UNKNOWN_CL), null);
+});
+
 add_test(function() {
   httpServer.stop(run_next_test);
 });

From 0101cbcbce090704b59019cea52f773ea564adad Mon Sep 17 00:00:00 2001
From: Masatoshi Kimura 
Date: Thu, 19 Feb 2015 04:12:58 +0900
Subject: [PATCH 080/115] Bug 1124039 - Allow RC4 only for whitelisted hosts.
 r=keeler

---
 .../test/browser_net_security-state.js        |  6 ++++
 .../test/browser_net_security-warnings.js     |  7 +++--
 security/manager/ssl/src/nsNSSIOLayer.cpp     | 29 ++++++++++---------
 3 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/browser/devtools/netmonitor/test/browser_net_security-state.js b/browser/devtools/netmonitor/test/browser_net_security-state.js
index 4db121e1f191..ae32473e6704 100644
--- a/browser/devtools/netmonitor/test/browser_net_security-state.js
+++ b/browser/devtools/netmonitor/test/browser_net_security-state.js
@@ -16,6 +16,12 @@ add_task(function* () {
     "rc4.example.com": "security-state-weak",
   };
 
+  yield new promise(resolve => {
+    SpecialPowers.pushPrefEnv({"set": [
+      ["security.tls.insecure_fallback_hosts", "rc4.example.com"]
+    ]}, resolve);
+  });
+
   let [tab, debuggee, monitor] = yield initNetMonitor(CUSTOM_GET_URL);
   let { $, EVENTS, NetMonitorView } = monitor.panelWin;
   let { RequestsMenu } = NetMonitorView;
diff --git a/browser/devtools/netmonitor/test/browser_net_security-warnings.js b/browser/devtools/netmonitor/test/browser_net_security-warnings.js
index 1cecfb85603c..f900c1d07a17 100644
--- a/browser/devtools/netmonitor/test/browser_net_security-warnings.js
+++ b/browser/devtools/netmonitor/test/browser_net_security-warnings.js
@@ -40,9 +40,12 @@ add_task(function* () {
   let { RequestsMenu, NetworkDetails } = NetMonitorView;
   RequestsMenu.lazyUpdate = false;
 
-  info("Enabling SSLv3 for the test.");
+  info("Enabling SSLv3 and RC4 for the test.");
   yield new promise(resolve => {
-    SpecialPowers.pushPrefEnv({"set": [["security.tls.version.min", 0]]}, resolve);
+    SpecialPowers.pushPrefEnv({"set": [
+      ["security.tls.version.min", 0],
+      ["security.tls.insecure_fallback_hosts", "rc4.example.com,ssl3rc4.example.com"]
+    ]}, resolve);
   });
 
   let cipher = $("#security-warning-cipher");
diff --git a/security/manager/ssl/src/nsNSSIOLayer.cpp b/security/manager/ssl/src/nsNSSIOLayer.cpp
index e3ea19d83b63..01a9d8aa50f0 100644
--- a/security/manager/ssl/src/nsNSSIOLayer.cpp
+++ b/security/manager/ssl/src/nsNSSIOLayer.cpp
@@ -1207,6 +1207,7 @@ retryDueToTLSIntolerance(PRErrorCode err, nsNSSSocketInfo* socketInfo)
   // Note this only happens during the initial SSL handshake.
 
   SSLVersionRange range = socketInfo->GetTLSVersionRange();
+  nsSSLIOLayerHelpers& helpers = socketInfo->SharedState().IOLayerHelpers();
 
   if (err == SSL_ERROR_INAPPROPRIATE_FALLBACK_ALERT) {
     // This is a clear signal that we've fallen back too many versions.  Treat
@@ -1216,30 +1217,31 @@ retryDueToTLSIntolerance(PRErrorCode err, nsNSSSocketInfo* socketInfo)
     // First, track the original cause of the version fallback.  This uses the
     // same buckets as the telemetry below, except that bucket 0 will include
     // all cases where there wasn't an original reason.
-    PRErrorCode originalReason = socketInfo->SharedState().IOLayerHelpers()
-      .getIntoleranceReason(socketInfo->GetHostName(), socketInfo->GetPort());
+    PRErrorCode originalReason =
+      helpers.getIntoleranceReason(socketInfo->GetHostName(),
+                                   socketInfo->GetPort());
     Telemetry::Accumulate(Telemetry::SSL_VERSION_FALLBACK_INAPPROPRIATE,
                           tlsIntoleranceTelemetryBucket(originalReason));
 
-    socketInfo->SharedState().IOLayerHelpers()
-      .forgetIntolerance(socketInfo->GetHostName(), socketInfo->GetPort());
+    helpers.forgetIntolerance(socketInfo->GetHostName(),
+                              socketInfo->GetPort());
 
     return false;
   }
 
   // Disallow PR_CONNECT_RESET_ERROR if fallback limit reached.
-  if (err == PR_CONNECT_RESET_ERROR &&
-      socketInfo->SharedState().IOLayerHelpers()
-        .fallbackLimitReached(socketInfo->GetHostName(), range.max)) {
+  bool fallbackLimitReached =
+    helpers.fallbackLimitReached(socketInfo->GetHostName(), range.max);
+  if (err == PR_CONNECT_RESET_ERROR && fallbackLimitReached) {
     return false;
   }
 
   if ((err == SSL_ERROR_NO_CYPHER_OVERLAP || err == PR_END_OF_FILE_ERROR ||
        err == PR_CONNECT_RESET_ERROR) &&
+      !fallbackLimitReached &&
       nsNSSComponent::AreAnyWeakCiphersEnabled()) {
-    if (socketInfo->SharedState().IOLayerHelpers()
-                  .rememberStrongCiphersFailed(socketInfo->GetHostName(),
-                                               socketInfo->GetPort(), err)) {
+    if (helpers.rememberStrongCiphersFailed(socketInfo->GetHostName(),
+                                            socketInfo->GetPort(), err)) {
       Telemetry::Accumulate(Telemetry::SSL_WEAK_CIPHERS_FALLBACK,
                             tlsIntoleranceTelemetryBucket(err));
       return true;
@@ -1301,10 +1303,9 @@ retryDueToTLSIntolerance(PRErrorCode err, nsNSSSocketInfo* socketInfo)
   // TLS intolerance fallback due to remembered tolerance.
   Telemetry::Accumulate(pre, reason);
 
-  if (!socketInfo->SharedState().IOLayerHelpers()
-                 .rememberIntolerantAtVersion(socketInfo->GetHostName(),
-                                              socketInfo->GetPort(),
-                                              range.min, range.max, err)) {
+  if (!helpers.rememberIntolerantAtVersion(socketInfo->GetHostName(),
+                                           socketInfo->GetPort(),
+                                           range.min, range.max, err)) {
     return false;
   }
 

From 17cbaa284965abb0e8b4d48b29215ce9b4f8e9a8 Mon Sep 17 00:00:00 2001
From: Masatoshi Kimura 
Date: Thu, 19 Feb 2015 04:12:59 +0900
Subject: [PATCH 081/115] Bug 1133187 - Update fallback whitelist. r=keeler

---
 .../ssl/src/IntolerantFallbackList.inc        | 47 ++++++++++---------
 1 file changed, 25 insertions(+), 22 deletions(-)

diff --git a/security/manager/ssl/src/IntolerantFallbackList.inc b/security/manager/ssl/src/IntolerantFallbackList.inc
index b2a6c9a3c934..152e3a00b498 100644
--- a/security/manager/ssl/src/IntolerantFallbackList.inc
+++ b/security/manager/ssl/src/IntolerantFallbackList.inc
@@ -17,6 +17,7 @@ static const char* const kIntolerantFallbackList[] =
   "actu.reunion.fr",
   "ad401k.sbisec.co.jp",
   "adman.you.gr",
+  "adsearch.kuronekoyamato.co.jp", // bug 1128366
   "affiliatewalla.com",
   "airportwifi.com", // bug 1116891
   "allyours.virginmedia.com",
@@ -25,6 +26,7 @@ static const char* const kIntolerantFallbackList[] =
   "apps.amerch.com",
   "apps.fpcu.org",
   "apps.sasken.com",
+  "apps.state.or.us", // bug 1130472
   "appsrv.restat.com",
   "arts.ac.uk",
   "ascii.jp",
@@ -44,6 +46,7 @@ static const char* const kIntolerantFallbackList[] =
   "blogwatcher.co.jp",
   "blueportal.vanmarcke.be",
   "bmypage.kuronekoyamato.co.jp", // bug 1128366
+  "bmypageapi.kuronekoyamato.co.jp", // bug 1128366
   "books.spec.whatwg.org", // RC4
   "books.wwnorton.com", // bug 1116891
   "bookstore.alma.edu",
@@ -111,6 +114,8 @@ static const char* const kIntolerantFallbackList[] =
   "dinsmore.fsmoffice.net",
   "direct-teleshop.jp",
   "direct.graydon.nl",
+  "docrecycle.kuronekoyamato.co.jp", // bug 1128366
+  "domparsing.spec.whatwg.org",
   "dream-prize.com",
   "dwwsyw.bjgjj.gov.cn",
   "e-mediador.fiatc.es",
@@ -136,6 +141,7 @@ static const char* const kIntolerantFallbackList[] =
   "eservices.palomar.edu",
   "etimebanker.bankofthewest.com", // bug 1127204
   "etrade.ftft.com.tw",
+  "eu.static.mega.co.nz", // bug 1133496
   "event.kasite.net",
   "extra.ytk.fi",
   "extranet.eurocontrol.int",
@@ -160,10 +166,10 @@ static const char* const kIntolerantFallbackList[] =
   "german.visitkorea.or.kr",
   "gestion.urjc.es",
   "giftcertificates.com",
+  "golfsearch.kuronekoyamato.co.jp", // bug 1128366
   "gosignmeup.com", // bug 1116891
   "gotimeforce.com",
   "hb.posted.co.rs",
-  "helpdesk.attask.com",
   "hercle.com",
   "hikkoshi.homes.co.jp",
   "hollowayusa.com",
@@ -215,6 +221,7 @@ static const char* const kIntolerantFallbackList[] =
   "mail.izhnet.ru",
   "mailoffer.merrickbank.com",
   "map.infonavit.org.mx",
+  "maplink.kuronekoyamato.co.jp", // bug 1128366
   "marketday.com", // bug 1092998
   "mbrapp.fpcu.org",
   "mccbookstore.mchenry.edu",
@@ -229,6 +236,8 @@ static const char* const kIntolerantFallbackList[] =
   "mimesniff.spec.whatwg.org", // RC4
   "miportal.urjc.es",
   "mobile.dream-prize.com",
+  "mobile.kuronekoyamato.co.jp", // bug 1128366
+  "mobileotodoke.kuronekoyamato.co.jp", // bug 1128366
   "mon-ulb.ulb.ac.be",
   "mwed.jp",
   "my.arts.ac.uk",
@@ -237,6 +246,7 @@ static const char* const kIntolerantFallbackList[] =
   "my.kyivstar.ua",
   "my.miit.ru",
   "my.officef5.com",
+  "myaccount.boostmobile.com", // bug 1112178
   "mybank.nbcb.com.cn",
   "mybanner.gvsu.edu",
   "myhancock.hancockcollege.edu",
@@ -244,10 +254,10 @@ static const char* const kIntolerantFallbackList[] =
   "myntc.ntc.edu",
   "mypage.homes.co.jp",
   "mytoi.kuronekoyamato.co.jp", // bug 1128366
-  "myucd.ucd.ie",
   "myuws.uws.edu.au",
   "nbank.hxb.com.cn",
   "nbc.epk.tv",
+  "netbolsa.bpinet.pt", // bug 1132399
   "niche.endsleigh.co.uk",
   "nmsmp.alsok.co.jp",
   "no1.nipponrentacar.co.jp",
@@ -286,7 +296,6 @@ static const char* const kIntolerantFallbackList[] =
   "publicjobs.ie",
   "publicrecords.com",
   "quirks.spec.whatwg.org", // RC4
-  "r.kaipoke.biz",
   "rakuraku-market.com",
   "rcp.kotoha.co.jp",
   "realestate.homes.co.jp",
@@ -296,12 +305,12 @@ static const char* const kIntolerantFallbackList[] =
   "relativitymedia.epk.tv",
   "renewals.cipd.co.uk",
   "repair.kuroneko-kadendr.jp", // bug 1128366
+  "repairmb.kuroneko-kadendr.jp", // bug 1128366
   "reputation.com",
   "research-report.uws.edu.au",
   "reserve.opas.jp",
   "resources.whatwg.org", // RC4
   "rpg.kotoha.co.jp",
-  "rr.com",
   "russian.visitkorea.or.kr",
   "s.aiasahi.jp",
   "sales.mibucorp.co.jp",
@@ -310,38 +319,39 @@ static const char* const kIntolerantFallbackList[] =
   "sboseweb.mcpsweb.org",
   "school.keystoneschoolonline.com",
   "schweser.com",
+  "secure-checkout.t-mobile.com", // bug 1133648
   "secure.bg-mania.jp",
   "secure.fortisbc.com",
   "secure.missouristate.edu",
   "secure.smartcart.com",
   "securedcard.merrickbank.com",
   "secureonline.dwp.gov.uk",
-  "selfcare.rr.com",
   "sems.hrd.ccsd.net",
   "service.autoc-one.jp",
   "services.apvma.gov.au",
   "servizionline.infogroup.it",
   "sgp.kotoha.co.jp",
   "shinchiku.homes.co.jp",
+  "ship-book.kuronekoyamato.co.jp", // bug 1128366
   "shop.autoc-one.jp",
   "shop.kagome.co.jp",
   "shop.lococom.jp",
   "shop.maxim-ic.com",
   "shop.nanairo.coop", // bug 1128318
-  "showcase-tv.com",
   "sigeduweb.udesa.edu.ar",
   "sirius.ws.ryukoku.ac.jp",
   "sisweb.ucd.ie",
   "slovanet.sk",
   "smartcart.com",
   "smarticon.geotrust.com",
+  "smp-cmypage.kuronekoyamato.co.jp", // bug 1128366
   "sony.epk.tv",
   "spanish.visitkorea.or.kr",
   "spp.kotoha.co.jp",
   "ss2.sfcollege.edu",
   "ss5.sfcollege.edu",
   "ssl.0634.co.jp",
-  "ssl.taisho-direct.jp",
+  "ssl.safaribooksonline.com", // bug 1133940
   "startrekonline.com",
   "store.closetmaid.com",
   "store.morningside.edu",
@@ -364,13 +374,12 @@ static const char* const kIntolerantFallbackList[] =
   "ticketseating.com",
   "ticketsupply.com",
   "tienda.boe.es",
-  "timewarnercable.com", // bug 1115883
   "todentaminen.posti.fi",
   "toushi.homes.co.jp",
   "trade.hsfund.com",
   "trueblue.jetblue.com",
   "tsuhanshokai.kuronekoyamato.co.jp", // bug 1128366
-  "twcbc.com",
+  "uketori.kuronekoyamato.co.jp", // bug 1128366
   "universal.epk.tv",
   "url.spec.whatwg.org", // RC4
   "userdoor.com",
@@ -381,7 +390,6 @@ static const char* const kIntolerantFallbackList[] =
   "uxxiportal.upct.es",
   "verkkokauppa.posti.fi",
   "vod.skyperfectv.co.jp",
-  "wayfarer.timewarnercable.com", // bug 1115883
   "web3.secureinternetbank.com", // bug 1111354
   "webapps.ou.edu",
   "webatm.landbank.com.tw",
@@ -410,8 +418,6 @@ static const char* const kIntolerantFallbackList[] =
   "www.araglegalcenter.com",
   "www.arts.ac.uk",
   "www.asknow.com",
-  "www.attask-ondemand.com",
-  "www.attask.com",
   "www.augustasportswear.com",
   "www.auroragov.org",
   "www.bancocredichile.cl",
@@ -431,6 +437,7 @@ static const char* const kIntolerantFallbackList[] =
   "www.bookstore.irsc.edu",
   "www.bookstore.mtu.edu",
   "www.bookstore.westga.edu",
+  "www.boostmobilesales.com", // 1112178
   "www.borsaitaliana.it",
   "www.bottegaverde.es",
   "www.bottegaverde.it",
@@ -448,6 +455,7 @@ static const char* const kIntolerantFallbackList[] =
   "www.cipd.co.uk",
   "www.club-animate.jp",
   "www.cngcorp.com",
+  "www.coastcapitalsavings.com", // bug 1132540
   "www.codan.dk",
   "www.comune.milano.it",
   "www.credem.it",
@@ -518,14 +526,12 @@ static const char* const kIntolerantFallbackList[] =
   "www.hx168.com.cn",
   "www.i-misdo.com",
   "www.iezukuri-net.com",
-  "www.illori.com.tw",
   "www.ingramentertainment.com",
   "www.interpark.com",
   "www.jaf.or.jp",
   "www.jhct.co.jp",
   "www.jifenpay.com",
   "www.kaigojob.com",
-  "www.kaipoke.biz",
   "www.kasite.net",
   "www.kfeducation.com",
   "www.khan.co.kr",
@@ -540,6 +546,7 @@ static const char* const kIntolerantFallbackList[] =
   "www.learndoj.gov",
   "www.lib.cwu.edu",
   "www.libraryvideo.com",
+  "www.licadho-cambodia.org", // bug 1133312
   "www.lm-order.de",
   "www.lococom.jp",
   "www.londonstockexchange.com",
@@ -568,7 +575,6 @@ static const char* const kIntolerantFallbackList[] =
   "www.myhomest.co.jp",
   "www.mynpcdata.net",
   "www.nec-nexs.com",
-  "www.nekonet-ios.jp",
   "www.neways.com",
   "www.newaysonline.com",
   "www.newchinalife.com",
@@ -586,6 +592,7 @@ static const char* const kIntolerantFallbackList[] =
   "www.peoples.com",
   "www.point-tactix.jp",
   "www.polla.cl",
+  "www.popehat.com", // RC4
   "www.priate.jp",
   "www.publicjobs.ie",
   "www.publicrecords.com",
@@ -595,9 +602,7 @@ static const char* const kIntolerantFallbackList[] =
   "www.renaultcredit.com.ar",
   "www.reputation.com",
   "www.riversendtrading.com",
-  "www.rr.com",
   "www.rubriquefidelite.com",
-  "www.ruskfrance.net",
   "www.s-book.net",
   "www.safepass.cn",
   "www.sandiegoimmunizationregistry.org",
@@ -609,7 +614,6 @@ static const char* const kIntolerantFallbackList[] =
   "www.shiki.jp",
   "www.shinsei.e-aichi.jp",
   "www.shop.bt.com",
-  "www.showcase-tv.com",
   "www.sihd-bk.jp",
   "www.sikatoru.com",
   "www.slovanet.sk",
@@ -621,7 +625,6 @@ static const char* const kIntolerantFallbackList[] =
   "www.sokamocka.com",
   "www.sports-nakama.com",
   "www.startrekonline.com",
-  "www.strade.com.vn",
   "www.stub.com",
   "www.stubpass.com",
   "www.sunderland.gov.uk",
@@ -633,10 +636,8 @@ static const char* const kIntolerantFallbackList[] =
   "www.thecopia.com",
   "www.ticketseating.com",
   "www.ticketsupply.com",
-  "www.timewarnercable.com", // bug 1115883
   "www.torrecatalunya.com",
   "www.transunion.ca",
-  "www.twcbc.com",
   "www.u-gakugei.ac.jp",
   "www.ubao.com",
   "www.uccard.co.jp",
@@ -655,7 +656,6 @@ static const char* const kIntolerantFallbackList[] =
   "www.world-family.co.jp",
   "www.xm-l-tax.gov.cn",
   "www.yakult.co.kr",
-  "www.youmeshop.jp",
   "www.yuuka.co.jp",
   "www.zenfolio.com",
   "www.zoominfo.com",
@@ -665,8 +665,11 @@ static const char* const kIntolerantFallbackList[] =
   "www2.shueisha.co.jp",
   "www2.sogo-gogo.com",
   "www2.wou.edu",
+  "www3.econ.ne.jp",
   "www3.ibac.co.jp",
   "www3.taiheiyo-ferry.co.jp",
+  "www4.econ.ne.jp",
+  "www5.econ.ne.jp",
   "wwws.kadokawa.co.jp",
   "xhr.spec.whatwg.org", // RC4
   "yeswellnesspro.fsmoffice.net",

From 35dc26890ee22d41b14d3c702633cb89a5c0b445 Mon Sep 17 00:00:00 2001
From: Ryan VanderMeulen 
Date: Wed, 18 Feb 2015 14:46:42 -0500
Subject: [PATCH 082/115] Backed out changeset e4962045c59c (bug 1131798) for
 Win8 build bustage.

--HG--
extra : rebase_source : 0f196b6774783dd804bb39a19a850297a650c121
---
 python/eme/gen-eme-voucher.py | 346 ++++++++--------------------------
 1 file changed, 78 insertions(+), 268 deletions(-)

diff --git a/python/eme/gen-eme-voucher.py b/python/eme/gen-eme-voucher.py
index 40da5d11308e..24d1cb8b98d5 100644
--- a/python/eme/gen-eme-voucher.py
+++ b/python/eme/gen-eme-voucher.py
@@ -1,5 +1,4 @@
-#!/usr/bin/env python2.7
-#
+#!/usr/bin/env python
 # Copyright 2014 Adobe Systems Incorporated. All Rights Reserved.
 #
 # Adobe permits you to use, modify, and distribute this file in accordance
@@ -7,18 +6,17 @@
 # a copy of the MPL was not distributed with this file, You can obtain one
 # at http://mozilla.org/MPL/2.0/.
 #
-# Creates an Adobe Access signed voucher for any executable
-#   Notes: This is currently python2.7 due to mozilla build system requirements
+# Create perforce changelist of modules from FTP server
 
-import argparse, bitstring, pprint, hashlib, os, subprocess, sys, tempfile
-from pyasn1.codec.der import encoder as der_encoder
+import io, argparse,pyasn1, bitstring
+from pyasn1.codec.der import encoder, decoder
 from pyasn1.type import univ, namedtype, namedval, constraint
-
+import hashlib
 
 # CodeSectionDigest ::= SEQUENCE {
-#   offset				INTEGER --  section's file offset in the signed binary
-#   digestAlgorithm		OBJECT IDENTIFIER -- algorithm identifier for the hash value below. For now only supports SHA256.
-#   digestValue			OCTET STRING -- hash value of the TEXT segment.
+# offset				INTEGER --  section's file offset in the signed binary
+# digestAlgorithm		OBJECT IDENTIFIER -- algorithm identifier for the hash value below. For now only supports SHA256.
+# digestValue			OCTET STRING -- hash value of the TEXT segment.
 # }
 class CodeSectionDigest(univ.Sequence):
 	componentType = namedtype.NamedTypes(
@@ -26,7 +24,6 @@ class CodeSectionDigest(univ.Sequence):
 		namedtype.NamedType('digestAlgorithm', univ.ObjectIdentifier()),
 		namedtype.NamedType('digest', univ.OctetString()))
 
-
 # CodeSegmentDigest ::= SEQUENCE {
 #	 offset				INTEGER -- TEXT segment's file offset in the signed binary
 #	 codeSectionDigests			SET OF CodeSectionDigests
@@ -35,22 +32,20 @@ class CodeSectionDigest(univ.Sequence):
 class SetOfCodeSectionDigest(univ.SetOf):
 	componentType = CodeSectionDigest()
 
-
 class CodeSegmentDigest(univ.Sequence):
 	componentType = namedtype.NamedTypes(
 		namedtype.NamedType('offset', univ.Integer()),
 		namedtype.NamedType('codeSectionDigests', SetOfCodeSectionDigest()))
 
-
 # ArchitectureDigest ::= SEQUENCE {
 # 	cpuType                ENUMERATED CpuType
 # 	cpuSubType				ENUMERATED CpuSubType
 # 	CodeSegmentDigests		SET OF CodeSegmentDigests
 # }
+
 class SetOfCodeSegmentDigest(univ.SetOf):
 	componentType = CodeSegmentDigest()
 
-
 class CPUType(univ.Enumerated):
 	namedValues = namedval.NamedValues(
 		('IMAGE_FILE_MACHINE_I386', 0x14c),
@@ -60,46 +55,34 @@ class CPUType(univ.Enumerated):
 				  constraint.SingleValueConstraint(0x14c, 0x8664)
 
 
-class CPUSubType(univ.Enumerated):
-	namedValues = namedval.NamedValues(
-		('IMAGE_UNUSED', 0x0),
-	)
-	subtypeSpec = univ.Enumerated.subtypeSpec + \
-				  constraint.SingleValueConstraint(0)
-
-
 class ArchitectureDigest(univ.Sequence):
 	componentType = namedtype.NamedTypes(
 		namedtype.NamedType('cpuType', CPUType()),
-		namedtype.NamedType('cpuSubType', CPUSubType()),
+		namedtype.NamedType('cpuSubType', univ.Integer()),
 		namedtype.NamedType('CodeSegmentDigests', SetOfCodeSegmentDigest())
 	)
 
-
-# ApplicationDigest ::= SEQUENCE {
-#   version    INTEGER
-#   digests    SET OF ArchitectureDigest
-# }
+#	 ApplicationDigest ::= SEQUENCE {
+#	 version    INTEGER
+#	 digests    SET OF ArchitectureDigest
+#	 }
 class SetOfArchitectureDigest(univ.SetOf):
 	componentType = ArchitectureDigest()
 
-
 class ApplicationDigest(univ.Sequence):
 	componentType = namedtype.NamedTypes(
 		namedtype.NamedType('version', univ.Integer()),
 		namedtype.NamedType('digests', SetOfArchitectureDigest())
 	)
 
-
-def meets_requirements(items, requirements):
+def meetsRequirements(items, requirements):
 	for r in requirements:
 		for n, v in r.items():
 			if n not in items or items[n] != v: return False
 	return True
 
-
 # return total number of bytes read from items_in excluding leaves
-def parse_items(stream, items_in, items_out):
+def parseItems(stream, items_in, items_out):
 	bits_read = 0
 	total_bits_read = 0
 
@@ -119,7 +102,7 @@ def parse_items(stream, items_in, items_out):
 			requirements = list(filter(lambda x: isinstance(x, dict), item[2]))
 			sub_items = list(filter(lambda x: isinstance(x, tuple), item[2]))
 
-			if not meets_requirements(items_out, requirements): continue
+			if not meetsRequirements(items_out, requirements): continue
 
 			# has sub-items based on length
 			items_out[name] = stream.read(t)
@@ -130,7 +113,7 @@ def parse_items(stream, items_in, items_out):
 				bit_length = items_out[name] * 8
 
 				if bit_length > 0:
-					sub_read, sub_total_read = parse_items(stream, sub_items, items_out)
+					sub_read, sub_total_read = parseItems(stream, sub_items, items_out)
 					bit_length -= sub_read
 					total_bits_read += sub_total_read
 
@@ -144,7 +127,6 @@ def parse_items(stream, items_in, items_out):
 	return bits_read, total_bits_read
 
 
-# TODO: perhaps switch to pefile module when it officially supports python3
 class SectionHeader:
 	def __init__(self, stream):
 		items = [
@@ -159,115 +141,15 @@ class SectionHeader:
 			('NumberOfLineNumbers', 'uintle:16'),
 			('Characteristics', 'uintle:32')
 		]
-		self.items = dict()
-		self.relocs = dict()
-
-		_, self.bits_read = parse_items(stream, items, self.items)
+		self.items = {}
+		_, self.bits_read = parseItems(stream, items, self.items)
 
 		self.sectionName = self.items['Name'].decode('utf-8')
 		self.offset = self.items['PointerToRawData']
 
-COFF_DATA_DIRECTORY_TYPES = [
-	"Export Table",
-	"Import Table",
-	"Resource Table",
-	"Exception Table",
-	"Certificate Tble",
-	"Base Relocation Table",
-	"Debug",
-	"Architecture",
-	"Global Ptr",
-	"TLS Table",
-	"Load Config Table",
-	"Bound Import",
-	"IAT",
-	"Delay Import Descriptor",
-	"CLR Runtime Header",
-	"Reserved",
-]
-
-
-def chained_safe_get(obj, names, default=None):
-	if obj is None: return default
-
-	for n in names:
-		if n in obj:
-			obj = obj[n]
-		else:
-			return default
-
-	return obj
-
-
-class OptionalHeader:
-	def __init__(self, stream, size):
-		self.items = {}
-		items = []
-
-		if size:
-			items += [
-				('Magic', 'uintle:16'),
-				('MajorLinkerVersion', 'uintle:8'),
-				('MinorLinkerVersion', 'uintle:8'),
-				('SizeOfCode', 'uintle:32'),
-				('SizeOfInitializedData', 'uintle:32'),
-				('SizeOfUninitializedData', 'uintle:32'),
-				('AddressOfEntryPoint', 'uintle:32'),
-				('BaseOfCode', 'uintle:32'),
-			]
-
-			_, self.bits_read = parse_items(stream, items, self.items)
-
-			items = []
-			if self.items['Magic'] == 0x10b:  # PE32
-				items += [('BaseOfData', 'uintle:32')]
-
-			address_size = 'uintle:64' if self.items['Magic'] == 0x20b else 'uintle:32'
-
-			items += [
-				('ImageBase', address_size),
-				('SectionAlignment', 'uintle:32'),
-				('FileAlignment', 'uintle:32'),
-				('MajorOperatingSystemVersion', 'uintle:16'),
-				('MinorOperatingSystemVersion', 'uintle:16'),
-				('MajorImageVersion', 'uintle:16'),
-				('MinorImageVersion', 'uintle:16'),
-				('MajorSubsystemVersion', 'uintle:16'),
-				('MinorSubsystemVersion', 'uintle:16'),
-				('Win32VersionValue', 'uintle:32'),
-				('SizeOfImage', 'uintle:32'),
-				('SizeOfHeaders', 'uintle:32'),
-				('CheckSum', 'uintle:32'),
-				('Subsystem', 'uintle:16'),
-				('DllCharacteristics', 'uintle:16'),
-				('SizeOfStackReserve', address_size),
-				('SizeOfStackCommit', address_size),
-				('SizeOfHeapReserve', address_size),
-				('SizeOfHeapCommit', address_size),
-				('LoaderFlags', 'uintle:32'),
-				('NumberOfRvaAndSizes', 'uintle:32'),
-			]
-
-		if size > 28:
-			_, bits_read = parse_items(stream, items, self.items)
-			self.bits_read += bits_read
-
-		if 'NumberOfRvaAndSizes' in self.items:
-			index = 0
-			self.items['Data Directories'] = dict()
-			while self.bits_read / 8 < size:
-				d = self.items['Data Directories'][COFF_DATA_DIRECTORY_TYPES[index]] = dict()
-
-				_, bits_read = parse_items(stream, [('VirtualAddress', 'uintle:32'), ('Size', 'uintle:32')], d)
-				self.bits_read += bits_read
-				index += 1
-
 
 class COFFFileHeader:
 	def __init__(self, stream):
-		self.items = {}
-		self.section_headers = []
-
 		items = [
 			('Machine', 'uintle:16'),
 			('NumberOfSections', 'uintle:16'),
@@ -277,178 +159,106 @@ class COFFFileHeader:
 			('SizeOfOptionalHeader', 'uintle:16'),
 			('Characteristics', 'uintle:16')
 		]
-		_, self.bits_read = parse_items(stream, items, self.items)
+		self.items = {}
+		_, self.bits_read = parseItems(stream, items, self.items)
 
-		self.OptionalHeader = OptionalHeader(stream, self.items['SizeOfOptionalHeader'])
-		self.bits_read += self.OptionalHeader.bits_read
+		#skip over optional header.
+		if self.items['SizeOfOptionalHeader'] > 0:
+			stream.read(self.items['SizeOfOptionalHeader'] * 8)
+			self.bits_read += self.items['SizeOfOptionalHeader'] * 8
 
-		# start reading section headers
-		num_sections = self.items['NumberOfSections']
+		#start reading section headers
+		numberOfSections = self.items['NumberOfSections']
+		self.codeSectionHeaders = []
 
-		while num_sections > 0 :
-			section_header = SectionHeader(stream)
-			self.bits_read += section_header.bits_read
-			self.section_headers.append(section_header)
-			num_sections -= 1
+		while numberOfSections > 0 :
+			sectionHeader = SectionHeader(stream)
+			if (sectionHeader.items['Characteristics'] & 0x20000000) == 0x20000000:
+				self.codeSectionHeaders.append(sectionHeader)
+			numberOfSections -= 1
 
-		self.section_headers.sort(key=lambda header: header.offset)
-
-		# Read Relocations
-		self.process_relocs(stream)
-
-	def process_relocs(self, stream):
-		reloc_table = chained_safe_get(self.OptionalHeader.items, ['Data Directories', 'Base Relocation Table'])
-		if reloc_table is None: return
-
-		orig_pos = stream.bitpos
-		_, stream.bytepos = self.get_rva_section(reloc_table['VirtualAddress'])
-		end_pos = stream.bitpos + reloc_table['Size'] * 8
-
-		while stream.bitpos < end_pos:
-			page_rva = stream.read('uintle:32')
-			block_size = stream.read('uintle:32')
-
-			for i in range(0, int((block_size - 8) / 2)):
-				data = stream.read('uintle:16')
-				typ = data >> 12
-				offset = data & 0xFFF
-
-				if offset == 0 and i > 0: continue
-
-				assert(typ == 3)
-
-				cur_pos = stream.bitpos
-				sh, value_bytepos = self.get_rva_section(page_rva + offset)
-				stream.bytepos = value_bytepos
-				value = stream.read('uintle:32')
-
-				# remove BaseAddress
-				value -= self.OptionalHeader.items['ImageBase']
-
-				stream.overwrite(bitstring.BitArray(uint=value, length=4 * 8), pos=value_bytepos * 8)
-				stream.pos = cur_pos
-
-		stream.bitpos = orig_pos
-
-	def get_rva_section(self, rva):
-		for sh in self.section_headers:
-			if rva < sh.items['VirtualAddress'] or rva >= sh.items['VirtualAddress'] + sh.items['VirtualSize']:
-				continue
-
-			file_pointer = rva - sh.items['VirtualAddress'] + sh.items['PointerToRawData']
-			return sh, file_pointer
-
-		raise Exception('Could not match RVA to section')
+		self.codeSectionHeaders.sort(key=lambda header: header.offset)
 
 
-def create_temp_file(suffix=""):
-	fd, path = tempfile.mkstemp(suffix=suffix)
-	os.close(fd)
-	return path
-	
-# TIPS:
-#  How to convert PFX to PEM: openssl pkcs12 -in build/certificates/testPKI/IV.pfx -out build/certificates/testPKI/IV.cert.pem
 def main():
-	parser = argparse.ArgumentParser(description='PE/COFF Signer')
+	parser = argparse.ArgumentParser(description='PE/COFF Parser.')
 	parser.add_argument('-input', required=True, help="File to parse.")
 	parser.add_argument('-output', required=True, help="File to write to.")
-	parser.add_argument('-openssl_path',help="Path to OpenSSL to create signed voucher")
-	parser.add_argument('-signer_cert',help="Path to certificate to use to sign voucher.  Must be PEM encoded.")
 	parser.add_argument('-verbose', action='store_true', help="Verbose output.")
 	app_args = parser.parse_args()
 
-	# to simplify relocation handling we use a mutable BitStream so we can remove
-	# the BaseAddress from each relocation
-	stream = bitstring.BitStream(filename=app_args.input)
-
+	stream = bitstring.ConstBitStream(filename=app_args.input)
 	# find the COFF header.
 	# skip forward past the MSDOS stub header to 0x3c.
+
 	stream.bytepos = 0x3c
 
 	# read 4 bytes, this is the file offset of the PE signature.
-	pe_sig_offset = stream.read('uintle:32')
-	stream.bytepos = pe_sig_offset
+	peSignatureOffset = stream.read('uintle:32')
+	stream.bytepos = peSignatureOffset
 
-	# read 4 bytes, make sure it's a PE signature.
+	#read 4 bytes, make sure it's a PE signature.
 	signature = stream.read('uintle:32')
-	if signature != 0x00004550:
-		raise Exception("Invalid File")
+	if signature != 0x00004550 :
+		return
 
-	# after signature is the actual COFF file header.
-	coff_header = COFFFileHeader(stream)
 
-	arch_digest = ArchitectureDigest()
-	if coff_header.items['Machine'] == 0x14c:
-		arch_digest.setComponentByName('cpuType', CPUType('IMAGE_FILE_MACHINE_I386'))
-	elif coff_header.items['Machine'] == 0x8664:
-		arch_digest.setComponentByName('cpuType', CPUType('IMAGE_FILE_MACHINE_AMD64'))
+	archDigest = ArchitectureDigest()
 
-	arch_digest.setComponentByName('cpuSubType', CPUSubType('IMAGE_UNUSED'))
+	codeSegmentDigests = SetOfCodeSegmentDigest()
+	codeSegmentIdx = 0
 
-	text_section_headers = list(filter(lambda x: (x.items['Characteristics'] & 0x20000000) == 0x20000000, coff_header.section_headers))
+	#after signature is the actual COFF file header.
+	coffFileHeader = COFFFileHeader(stream)
 
-	code_segment_digests = SetOfCodeSegmentDigest()
-	code_segment_idx = 0
-	for code_sect_header in text_section_headers:
-		stream.bytepos = code_sect_header.offset
-		code_sect_bytes = stream.read('bytes:' + str(code_sect_header.items['VirtualSize']))
+	if coffFileHeader.items['Machine'] == 0x14c:
+		archDigest.setComponentByName('cpuType', CPUType('IMAGE_FILE_MACHINE_I386'))
+	elif coffFileHeader.items['Machine'] == 0x8664:
+		archDigest.setComponentByName('cpuType', CPUType('IMAGE_FILE_MACHINE_AMD64'))
+
+	archDigest.setComponentByName('cpuSubType', 0)
+
+
+	for codeSectionHeader in coffFileHeader.codeSectionHeaders:
+		stream.bytepos = codeSectionHeader.offset
+		codeSectionBytes = stream.read('bytes:'+ str(codeSectionHeader.items['SizeOfRawData']))
+		if codeSectionHeader.items['SizeOfRawData'] < codeSectionHeader.items['VirtualSize']:
+			#zero pad up to virtualSize
+			codeSectionBytes += "\0" * (codeSectionHeader.items['VirtualSize']-codeSectionHeader.items['SizeOfRawData'])
 
 		digester = hashlib.sha256()
-		digester.update(code_sect_bytes)
+		digester.update(codeSectionBytes)
 		digest = digester.digest()
 
-		# with open('segment_' + str(code_sect_header.offset) + ".bin", 'wb') as f:
-		#   f.write(code_sect_bytes)
+		codeSectionDigest = CodeSectionDigest()
+		codeSectionDigest.setComponentByName('offset', codeSectionHeader.offset)
+		codeSectionDigest.setComponentByName('digestAlgorithm', univ.ObjectIdentifier('2.16.840.1.101.3.4.2.1'))
+		codeSectionDigest.setComponentByName('digest', univ.OctetString(digest))
 
-		code_section_digest = CodeSectionDigest()
-		code_section_digest.setComponentByName('offset', code_sect_header.offset)
-		code_section_digest.setComponentByName('digestAlgorithm', univ.ObjectIdentifier('2.16.840.1.101.3.4.2.1'))
-		code_section_digest.setComponentByName('digest', univ.OctetString(digest))
-
-		set_of_digest = SetOfCodeSectionDigest()
-		set_of_digest.setComponentByPosition(0, code_section_digest)
+		setOfDigest = SetOfCodeSectionDigest()
+		setOfDigest.setComponentByPosition(0, codeSectionDigest)
 
 		codeSegmentDigest = CodeSegmentDigest()
-		codeSegmentDigest.setComponentByName('offset', code_sect_header.offset)
-		codeSegmentDigest.setComponentByName('codeSectionDigests', set_of_digest)
+		codeSegmentDigest.setComponentByName('offset', codeSectionHeader.offset)
+		codeSegmentDigest.setComponentByName('codeSectionDigests', setOfDigest)
 
-		code_segment_digests.setComponentByPosition(code_segment_idx, codeSegmentDigest)
-		code_segment_idx += 1
+		codeSegmentDigests.setComponentByPosition(codeSegmentIdx, codeSegmentDigest)
+		codeSegmentIdx += 1
 
-	arch_digest.setComponentByName('CodeSegmentDigests', code_segment_digests)
+	archDigest.setComponentByName('CodeSegmentDigests', codeSegmentDigests)
 
 	setOfArchDigests = SetOfArchitectureDigest()
-	setOfArchDigests.setComponentByPosition(0, arch_digest)
+	setOfArchDigests.setComponentByPosition(0, archDigest)
 
 	appDigest = ApplicationDigest()
 
 	appDigest.setComponentByName('version', 1)
 	appDigest.setComponentByName('digests', setOfArchDigests)
 
-	binaryDigest = der_encoder.encode(appDigest)
+	binaryDigest = encoder.encode(appDigest)
 
-	with open(app_args.output, 'wb') as f:
-		f.write(binaryDigest)
-
-	# sign with openssl if specified
-	if app_args.openssl_path is not None:
-		assert app_args.signer_cert is not None
-		
-		out_base, out_ext = os.path.splitext(app_args.output)
-		signed_path = out_base + ".signed" + out_ext
-		
-		# http://stackoverflow.com/questions/12507277/how-to-fix-unable-to-write-random-state-in-openssl
-		temp_file = None
-		if sys.platform == "win32" and "RANDFILE" not in os.environ:
-			temp_file = create_temp_file()
-			os.environ["RANDFILE"] = temp_file
-			
-		try:
-			subprocess.check_call([app_args.openssl_path, "cms", "-sign", "-nodetach", "-md", "sha256", "-binary", "-in", app_args.output, "-outform", "der", "-out", signed_path, "-signer", app_args.signer_cert], )
-		finally:
-			if temp_file is not None: 
-				del os.environ["RANDFILE"]
-				os.unlink(temp_file)
+	outFile = open(app_args.output, 'wb')
+	outFile.write(binaryDigest)
 
 if __name__ == '__main__':
 	main()

From 31b517eaf797dd508fb78484a965cc2e76464a34 Mon Sep 17 00:00:00 2001
From: Ryan VanderMeulen 
Date: Wed, 18 Feb 2015 14:47:27 -0500
Subject: [PATCH 083/115] Backed out changesets b7d9158b53e7 and 820a0cabcb92
 (bug 1131375) for Windows bustage. CLOSED TREE

--HG--
extra : rebase_source : be0f4ecf8aa06e10e503dbff675feeddd8442bf9
---
 dom/base/SameProcessMessageQueue.cpp   | 72 ----------------------
 dom/base/SameProcessMessageQueue.h     | 57 ------------------
 dom/base/moz.build                     |  2 -
 dom/base/nsFrameMessageManager.cpp     | 41 +++++++++----
 dom/base/nsFrameMessageManager.h       |  4 +-
 dom/base/nsInProcessTabChildGlobal.cpp | 32 ++++++----
 dom/base/nsInProcessTabChildGlobal.h   |  1 +
 dom/base/test/browser.ini              |  1 -
 dom/base/test/browser_ipc_order.js     | 83 --------------------------
 9 files changed, 55 insertions(+), 238 deletions(-)
 delete mode 100644 dom/base/SameProcessMessageQueue.cpp
 delete mode 100644 dom/base/SameProcessMessageQueue.h
 delete mode 100644 dom/base/test/browser_ipc_order.js

diff --git a/dom/base/SameProcessMessageQueue.cpp b/dom/base/SameProcessMessageQueue.cpp
deleted file mode 100644
index 0ae24174d3b7..000000000000
--- a/dom/base/SameProcessMessageQueue.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "SameProcessMessageQueue.h"
-
-using namespace mozilla;
-using namespace mozilla::dom;
-
-SameProcessMessageQueue* SameProcessMessageQueue::sSingleton;
-
-SameProcessMessageQueue::SameProcessMessageQueue()
-{
-}
-
-SameProcessMessageQueue::~SameProcessMessageQueue()
-{
-  // This code should run during shutdown, and we should already have pumped the
-  // event loop. So we should only see messages here if someone is sending
-  // messages pretty late in shutdown.
-  NS_WARN_IF_FALSE(mQueue.IsEmpty(), "Shouldn't send messages during shutdown");
-  sSingleton = nullptr;
-}
-
-void
-SameProcessMessageQueue::Push(Runnable* aRunnable)
-{
-  mQueue.AppendElement(aRunnable);
-  NS_DispatchToCurrentThread(aRunnable);
-}
-
-void
-SameProcessMessageQueue::Flush()
-{
-  nsTArray> queue;
-  mQueue.SwapElements(queue);
-  for (size_t i = 0; i < queue.Length(); i++) {
-    queue[i]->Run();
-  }
-}
-
-/* static */ SameProcessMessageQueue*
-SameProcessMessageQueue::Get()
-{
-  if (!sSingleton) {
-    sSingleton = new SameProcessMessageQueue();
-  }
-  return sSingleton;
-}
-
-SameProcessMessageQueue::Runnable::Runnable()
- : mDispatched(false)
-{
-}
-
-NS_IMPL_ISUPPORTS(SameProcessMessageQueue::Runnable, nsIRunnable)
-
-nsresult
-SameProcessMessageQueue::Runnable::Run()
-{
-  if (mDispatched) {
-    return NS_OK;
-  }
-
-  SameProcessMessageQueue* queue = SameProcessMessageQueue::Get();
-  queue->mQueue.RemoveElement(this);
-
-  mDispatched = true;
-  return HandleMessage();
-}
diff --git a/dom/base/SameProcessMessageQueue.h b/dom/base/SameProcessMessageQueue.h
deleted file mode 100644
index eff5fb42b29b..000000000000
--- a/dom/base/SameProcessMessageQueue.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_SameProcessMessageQueue_h
-#define mozilla_dom_SameProcessMessageQueue_h
-
-#include "nsIRunnable.h"
-#include "nsRefPtr.h"
-#include "nsTArray.h"
-
-namespace mozilla {
-namespace dom {
-
-class CancelableRunnable;
-
-class SameProcessMessageQueue
-{
-public:
-  SameProcessMessageQueue();
-  virtual ~SameProcessMessageQueue();
-
-  class Runnable : public nsIRunnable
-  {
-  public:
-    explicit Runnable();
-
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIRUNNABLE
-
-    virtual nsresult HandleMessage() = 0;
-
-  protected:
-    virtual ~Runnable() {}
-
-  private:
-    bool mDispatched;
-  };
-
-  void Push(Runnable* aRunnable);
-  void Flush();
-
-  static SameProcessMessageQueue* Get();
-
-private:
-  friend class CancelableRunnable;
-
-  nsTArray> mQueue;
-  static SameProcessMessageQueue* sSingleton;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_SameProcessMessageQueue_h
diff --git a/dom/base/moz.build b/dom/base/moz.build
index 0f8f5816183c..029497ab3aa8 100644
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -184,7 +184,6 @@ EXPORTS.mozilla.dom += [
     'PerformanceMeasure.h',
     'PerformanceResourceTiming.h',
     'ResponsiveImageSelector.h',
-    'SameProcessMessageQueue.h',
     'ScreenOrientation.h',
     'ScriptSettings.h',
     'ShadowRoot.h',
@@ -320,7 +319,6 @@ UNIFIED_SOURCES += [
     'PerformanceMeasure.cpp',
     'PerformanceResourceTiming.cpp',
     'ResponsiveImageSelector.cpp',
-    'SameProcessMessageQueue.cpp',
     'ScriptSettings.cpp',
     'ShadowRoot.cpp',
     'StyleSheetList.cpp',
diff --git a/dom/base/nsFrameMessageManager.cpp b/dom/base/nsFrameMessageManager.cpp
index a878053eb029..d79956c93ef3 100644
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -33,7 +33,6 @@
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/nsIContentParent.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
-#include "mozilla/dom/SameProcessMessageQueue.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/StructuredCloneUtils.h"
 #include "mozilla/dom/ipc/BlobChild.h"
@@ -1631,6 +1630,7 @@ NS_IMPL_ISUPPORTS(nsScriptCacheCleaner, nsIObserver)
 nsFrameMessageManager* nsFrameMessageManager::sChildProcessManager = nullptr;
 nsFrameMessageManager* nsFrameMessageManager::sParentProcessManager = nullptr;
 nsFrameMessageManager* nsFrameMessageManager::sSameProcessParentManager = nullptr;
+nsTArray >* nsFrameMessageManager::sPendingSameProcessAsyncMessages = nullptr;
 
 class nsAsyncMessageToSameProcessChild : public nsSameProcessAsyncMessageBase,
                                          public nsRunnable
@@ -1779,7 +1779,7 @@ public:
 
 
 class nsAsyncMessageToSameProcessParent : public nsSameProcessAsyncMessageBase,
-                                          public SameProcessMessageQueue::Runnable
+                                          public nsRunnable
 {
 public:
   nsAsyncMessageToSameProcessParent(JSContext* aCx,
@@ -1788,15 +1788,25 @@ public:
                                     JS::Handle aCpows,
                                     nsIPrincipal* aPrincipal)
     : nsSameProcessAsyncMessageBase(aCx, aMessage, aData, aCpows, aPrincipal)
+    , mDelivered(false)
   {
   }
 
-  NS_IMETHOD HandleMessage()
+  NS_IMETHOD Run()
   {
-    nsFrameMessageManager* ppm = nsFrameMessageManager::sSameProcessParentManager;
-    ReceiveMessage(static_cast(ppm), ppm);
+    if (nsFrameMessageManager::sPendingSameProcessAsyncMessages) {
+      nsFrameMessageManager::sPendingSameProcessAsyncMessages->RemoveElement(this);
+    }
+    if (!mDelivered) {
+      mDelivered = true;
+      nsFrameMessageManager* ppm = nsFrameMessageManager::sSameProcessParentManager;
+      ReceiveMessage(static_cast(ppm), ppm);
+    }
     return NS_OK;
   }
+
+private:
+  bool mDelivered;
 };
 
 /**
@@ -1822,9 +1832,15 @@ public:
                                      InfallibleTArray* aJSONRetVal,
                                      bool aIsSync) MOZ_OVERRIDE
   {
-    SameProcessMessageQueue* queue = SameProcessMessageQueue::Get();
-    queue->Flush();
-
+    nsTArray > asyncMessages;
+    if (nsFrameMessageManager::sPendingSameProcessAsyncMessages) {
+      asyncMessages.SwapElements(*nsFrameMessageManager::sPendingSameProcessAsyncMessages);
+      uint32_t len = asyncMessages.Length();
+      for (uint32_t i = 0; i < len; ++i) {
+        nsCOMPtr async = asyncMessages[i];
+        async->Run();
+      }
+    }
     if (nsFrameMessageManager::sSameProcessParentManager) {
       SameProcessCpowHolder cpows(js::GetRuntime(aCx), aCpows);
       nsRefPtr ppm = nsFrameMessageManager::sSameProcessParentManager;
@@ -1840,10 +1856,13 @@ public:
                                   JS::Handle aCpows,
                                   nsIPrincipal* aPrincipal) MOZ_OVERRIDE
   {
-    SameProcessMessageQueue* queue = SameProcessMessageQueue::Get();
-    nsRefPtr ev =
+    if (!nsFrameMessageManager::sPendingSameProcessAsyncMessages) {
+      nsFrameMessageManager::sPendingSameProcessAsyncMessages = new nsTArray >;
+    }
+    nsCOMPtr ev =
       new nsAsyncMessageToSameProcessParent(aCx, aMessage, aData, aCpows, aPrincipal);
-    queue->Push(ev);
+    nsFrameMessageManager::sPendingSameProcessAsyncMessages->AppendElement(ev);
+    NS_DispatchToCurrentThread(ev);
     return true;
   }
 
diff --git a/dom/base/nsFrameMessageManager.h b/dom/base/nsFrameMessageManager.h
index 0b0dbd15da0c..30708cf534f4 100644
--- a/dom/base/nsFrameMessageManager.h
+++ b/dom/base/nsFrameMessageManager.h
@@ -27,7 +27,6 @@
 #include "mozilla/Attributes.h"
 #include "js/RootingAPI.h"
 #include "nsTObserverArray.h"
-#include "mozilla/dom/SameProcessMessageQueue.h"
 #include "mozilla/dom/StructuredCloneUtils.h"
 #include "mozilla/jsipc/CpowHolder.h"
 
@@ -201,7 +200,8 @@ private:
       }
       if (this == sChildProcessManager) {
         sChildProcessManager = nullptr;
-        delete mozilla::dom::SameProcessMessageQueue::Get();
+        delete sPendingSameProcessAsyncMessages;
+        sPendingSameProcessAsyncMessages = nullptr;
       }
       if (this == sSameProcessParentManager) {
         sSameProcessParentManager = nullptr;
diff --git a/dom/base/nsInProcessTabChildGlobal.cpp b/dom/base/nsInProcessTabChildGlobal.cpp
index 551f8a3f41d7..04500690f86c 100644
--- a/dom/base/nsInProcessTabChildGlobal.cpp
+++ b/dom/base/nsInProcessTabChildGlobal.cpp
@@ -19,7 +19,6 @@
 #include "nsIMozBrowserFrame.h"
 #include "nsDOMClassInfoID.h"
 #include "mozilla/EventDispatcher.h"
-#include "mozilla/dom/SameProcessMessageQueue.h"
 #include "mozilla/dom/StructuredCloneUtils.h"
 #include "js/StructuredClone.h"
 
@@ -36,9 +35,13 @@ nsInProcessTabChildGlobal::DoSendBlockingMessage(JSContext* aCx,
                                                  InfallibleTArray* aJSONRetVal,
                                                  bool aIsSync)
 {
-  SameProcessMessageQueue* queue = SameProcessMessageQueue::Get();
-  queue->Flush();
-
+  nsTArray > asyncMessages;
+  asyncMessages.SwapElements(mASyncMessages);
+  uint32_t len = asyncMessages.Length();
+  for (uint32_t i = 0; i < len; ++i) {
+    nsCOMPtr async = asyncMessages[i];
+    async->Run();
+  }
   if (mChromeMessageManager) {
     SameProcessCpowHolder cpows(js::GetRuntime(aCx), aCpows);
     nsRefPtr mm = mChromeMessageManager;
@@ -49,7 +52,7 @@ nsInProcessTabChildGlobal::DoSendBlockingMessage(JSContext* aCx,
 }
 
 class nsAsyncMessageToParent : public nsSameProcessAsyncMessageBase,
-                               public SameProcessMessageQueue::Runnable
+                               public nsRunnable
 {
 public:
   nsAsyncMessageToParent(JSContext* aCx,
@@ -59,16 +62,25 @@ public:
                          JS::Handle aCpows,
                          nsIPrincipal* aPrincipal)
     : nsSameProcessAsyncMessageBase(aCx, aMessage, aData, aCpows, aPrincipal),
-      mTabChild(aTabChild)
+      mTabChild(aTabChild), mRun(false)
   {
   }
 
-  NS_IMETHOD HandleMessage()
+  NS_IMETHOD Run()
   {
+    if (mRun) {
+      return NS_OK;
+    }
+
+    mRun = true;
+    mTabChild->mASyncMessages.RemoveElement(this);
     ReceiveMessage(mTabChild->mOwner, mTabChild->mChromeMessageManager);
     return NS_OK;
   }
   nsRefPtr mTabChild;
+  // True if this runnable has already been called. This can happen if DoSendSyncMessage
+  // is called while waiting for an asynchronous message send.
+  bool mRun;
 };
 
 bool
@@ -78,10 +90,10 @@ nsInProcessTabChildGlobal::DoSendAsyncMessage(JSContext* aCx,
                                               JS::Handle aCpows,
                                               nsIPrincipal* aPrincipal)
 {
-  SameProcessMessageQueue* queue = SameProcessMessageQueue::Get();
-  nsRefPtr ev =
+  nsCOMPtr ev =
     new nsAsyncMessageToParent(aCx, this, aMessage, aData, aCpows, aPrincipal);
-  queue->Push(ev);
+  mASyncMessages.AppendElement(ev);
+  NS_DispatchToCurrentThread(ev);
   return true;
 }
 
diff --git a/dom/base/nsInProcessTabChildGlobal.h b/dom/base/nsInProcessTabChildGlobal.h
index 655b11e03a6a..de5313e007aa 100644
--- a/dom/base/nsInProcessTabChildGlobal.h
+++ b/dom/base/nsInProcessTabChildGlobal.h
@@ -175,6 +175,7 @@ protected:
 public:
   nsIContent* mOwner;
   nsFrameMessageManager* mChromeMessageManager;
+  nsTArray > mASyncMessages;
 };
 
 #endif
diff --git a/dom/base/test/browser.ini b/dom/base/test/browser.ini
index 4b46267ffed7..923b7cc35a24 100644
--- a/dom/base/test/browser.ini
+++ b/dom/base/test/browser.ini
@@ -9,4 +9,3 @@ skip-if = e10s # Bug ?????? - test e10s utils don't support load events from ifr
 skip-if = true # Intermittent failures - bug 987493. Restore the skip-if above once fixed
 [browser_bug1058164.js]
 skip-if = e10s # We need bug 918634 to land before this can be tested with e10s.
-[browser_ipc_order.js]
diff --git a/dom/base/test/browser_ipc_order.js b/dom/base/test/browser_ipc_order.js
deleted file mode 100644
index e77f6215e208..000000000000
--- a/dom/base/test/browser_ipc_order.js
+++ /dev/null
@@ -1,83 +0,0 @@
-add_task(function*() {
-  let frame_script = () => {
-    const { classes: Cc, interfaces: Ci } = Components;
-    let cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"].
-               getService(Ci.nsISyncMessageSender);
-
-    sendAsyncMessage("Test:Frame:Async");
-    cpmm.sendAsyncMessage("Test:Process:Async");
-    cpmm.sendSyncMessage("Test:Process:Sync");
-  };
-
-  // This must be a page that opens in the main process
-  let tab = gBrowser.addTab("about:robots");
-  let browser = tab.linkedBrowser;
-  let mm = browser.messageManager;
-  let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"].
-             getService(Ci.nsIMessageBroadcaster);
-  yield new Promise(resolve => browser.addEventListener("load", resolve, true));
-
-  let messages = [];
-  let promise = new Promise(resolve => {
-    let listener = message => {
-      messages.push(message.name)
-      if (messages.length == 3)
-        resolve();
-    };
-
-    mm.addMessageListener("Test:Frame:Async", listener);
-    ppmm.addMessageListener("Test:Process:Async", listener);
-    ppmm.addMessageListener("Test:Process:Sync", listener);
-  });
-
-  mm.loadFrameScript("data:,(" + frame_script.toString() + ")();", false);
-  yield promise;
-
-  gBrowser.removeTab(tab);
-
-  is(messages[0], "Test:Frame:Async", "Expected async frame message");
-  is(messages[1], "Test:Process:Async", "Expected async process message");
-  is(messages[2], "Test:Process:Sync", "Expected sync process message");
-});
-
-add_task(function*() {
-  let frame_script = () => {
-    const { classes: Cc, interfaces: Ci } = Components;
-    let cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"].
-               getService(Ci.nsISyncMessageSender);
-
-    cpmm.sendAsyncMessage("Test:Process:Async");
-    sendAsyncMessage("Test:Frame:Async");
-    sendSyncMessage("Test:Frame:Sync");
-  };
-
-  // This must be a page that opens in the main process
-  let tab = gBrowser.addTab("about:robots");
-  let browser = tab.linkedBrowser;
-  let mm = browser.messageManager;
-  let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"].
-             getService(Ci.nsIMessageBroadcaster);
-  yield new Promise(resolve => browser.addEventListener("load", resolve, true));
-
-  let messages = [];
-  let promise = new Promise(resolve => {
-    let listener = message => {
-      messages.push(message.name)
-      if (messages.length == 3)
-        resolve();
-    };
-
-    ppmm.addMessageListener("Test:Process:Async", listener);
-    mm.addMessageListener("Test:Frame:Async", listener);
-    mm.addMessageListener("Test:Frame:Sync", listener);
-  });
-
-  mm.loadFrameScript("data:,(" + frame_script.toString() + ")();", false);
-  yield promise;
-
-  gBrowser.removeTab(tab);
-
-  is(messages[0], "Test:Process:Async", "Expected async process message");
-  is(messages[1], "Test:Frame:Async", "Expected async frame message");
-  is(messages[2], "Test:Frame:Sync", "Expected sync frame message");
-});

From c7043b053d93ba2bd449f4d4764c4825a2ec25e1 Mon Sep 17 00:00:00 2001
From: Benjamin Bouvier 
Date: Wed, 18 Feb 2015 20:44:08 +0100
Subject: [PATCH 084/115] Bug 1134298: Fix assertion in MConstant::New to
 handle NaN; r=luke

--HG--
extra : rebase_source : d06940748caf7e1acb25848c780b4df3086263e2
---
 js/src/jit-test/tests/ion/testFloat32.js | 6 ++++++
 js/src/jit/MIR.cpp                       | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/js/src/jit-test/tests/ion/testFloat32.js b/js/src/jit-test/tests/ion/testFloat32.js
index 23712f109cb5..dfbc1e0cd5ef 100644
--- a/js/src/jit-test/tests/ion/testFloat32.js
+++ b/js/src/jit-test/tests/ion/testFloat32.js
@@ -37,6 +37,12 @@
         }))
     })();
     //
+    (function() {
+        // bug 1134298
+        for (var k = 0; k < 1; k++) {
+            Math.fround(Math.ceil(Math.fround(Math.acos(3.0))))
+        }
+    })();
 })();
 //
 // ION TESTS
diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp
index 9101b6ec6aae..d2a79a18d6fc 100644
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -31,6 +31,7 @@ using JS::ToInt32;
 
 using mozilla::NumbersAreIdentical;
 using mozilla::IsFloat32Representable;
+using mozilla::IsNaN;
 using mozilla::Maybe;
 using mozilla::DebugOnly;
 
@@ -629,7 +630,7 @@ MConstant *
 MConstant::NewTypedValue(TempAllocator &alloc, const Value &v, MIRType type, CompilerConstraintList *constraints)
 {
     MOZ_ASSERT(!IsSimdType(type));
-    MOZ_ASSERT_IF(type == MIRType_Float32, v.toDouble() == double(float(v.toDouble())));
+    MOZ_ASSERT_IF(type == MIRType_Float32, IsNaN(v.toDouble()) || v.toDouble() == double(float(v.toDouble())));
     MConstant *constant = new(alloc) MConstant(v, constraints);
     constant->setResultType(type);
     return constant;

From 8858594e1fdc13b79f1bed09d367324d68fd7b8a Mon Sep 17 00:00:00 2001
From: Botond Ballo 
Date: Wed, 18 Feb 2015 15:12:50 -0500
Subject: [PATCH 085/115] Bug 1131749 - Correct for errors in our approximation
 of the spring equation for overscroll physics that might otherwise violate an
 assumption. r=kats

---
 gfx/layers/apz/src/Axis.cpp | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/gfx/layers/apz/src/Axis.cpp b/gfx/layers/apz/src/Axis.cpp
index 5f05569b4008..f87f78193224 100644
--- a/gfx/layers/apz/src/Axis.cpp
+++ b/gfx/layers/apz/src/Axis.cpp
@@ -263,6 +263,23 @@ void Axis::StepOverscrollAnimation(double aStepDurationMilliseconds) {
   // Adjust the amount of overscroll based on the velocity.
   // Note that we allow for oscillations.
   mOverscroll += (mVelocity * aStepDurationMilliseconds);
+
+  // Our mechanism for translating a set of mOverscroll values that oscillate
+  // around zero to a set of GetOverscroll() values that have the same sign
+  // (so content is always stretched, never compressed) assumes that
+  // mOverscroll does not exceed mFirstOverscrollAnimationSample in magnitude.
+  // If our calculations were exact, this would be the case, as
+  // mFirstOverscrollAnimationSample is the value of mOverscroll at the first
+  // peak of the oscillation, and a dampened spring should never attain a
+  // displacement greater in magnitude than a previous peak. In our
+  // approximation calculations, however, this may not hold exactly. To ensure
+  // the assumption is not violated, we clamp the magnitude of mOverscroll.
+  if (fabs(mOverscroll) > fabs(mFirstOverscrollAnimationSample)) {
+    mOverscroll = (mOverscroll >= 0)
+                ? fabs(mFirstOverscrollAnimationSample)
+                : -fabs(mFirstOverscrollAnimationSample);
+
+  }
 }
 
 bool Axis::SampleOverscrollAnimation(const TimeDuration& aDelta) {

From 5abea51e9a7332e6eecc1892114613102139c9f4 Mon Sep 17 00:00:00 2001
From: Ryan VanderMeulen 
Date: Wed, 18 Feb 2015 16:00:33 -0500
Subject: [PATCH 086/115] Backed out changeset 25f90464e93b (bug 1065216) for
 Android mochitest failures.

---
 docshell/base/nsDocShell.cpp                  |  48 ---
 docshell/base/nsDocShell.h                    |   3 -
 dom/base/nsDocument.h                         |   2 +-
 dom/bindings/Bindings.conf                    |   8 -
 dom/fetch/Fetch.cpp                           |   5 -
 dom/fetch/Fetch.h                             |  16 +-
 .../base/nsIServiceWorkerManager.idl          |  12 +-
 dom/webidl/FetchEvent.webidl                  |  27 --
 dom/webidl/moz.build                          |   1 -
 dom/workers/ServiceWorkerEvents.cpp           | 276 -----------------
 dom/workers/ServiceWorkerEvents.h             |  75 -----
 dom/workers/ServiceWorkerManager.cpp          | 287 +-----------------
 dom/workers/ServiceWorkerManager.h            |   3 -
 .../test/serviceworkers/fetch/fetch_tests.js  |  54 ----
 .../fetch/fetch_worker_script.js              |  29 --
 .../test/serviceworkers/fetch/index.html      | 147 ---------
 .../test/serviceworkers/fetch_event_worker.js |  86 ------
 dom/workers/test/serviceworkers/mochitest.ini |   5 -
 .../test/serviceworkers/test_fetch_event.html |  61 ----
 .../base/nsINetworkInterceptController.idl    |  34 +--
 netwerk/protocol/http/HttpBaseChannel.cpp     |  10 +-
 netwerk/protocol/http/HttpBaseChannel.h       |   2 +-
 netwerk/protocol/http/HttpChannelChild.cpp    | 203 +++++--------
 netwerk/protocol/http/HttpChannelChild.h      |   2 +-
 netwerk/protocol/http/InterceptedChannel.cpp  |  98 ++----
 netwerk/protocol/http/InterceptedChannel.h    |  31 +-
 .../test/unit/test_synthesized_response.js    |  73 +----
 27 files changed, 148 insertions(+), 1450 deletions(-)
 delete mode 100644 dom/webidl/FetchEvent.webidl
 delete mode 100644 dom/workers/test/serviceworkers/fetch/fetch_tests.js
 delete mode 100644 dom/workers/test/serviceworkers/fetch/fetch_worker_script.js
 delete mode 100644 dom/workers/test/serviceworkers/fetch/index.html
 delete mode 100644 dom/workers/test/serviceworkers/fetch_event_worker.js
 delete mode 100644 dom/workers/test/serviceworkers/test_fetch_event.html

diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index 48e9612f457b..d6f2faf92e04 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -52,7 +52,6 @@
 #include "nsIAuthPrompt2.h"
 #include "nsIChannelEventSink.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
-#include "nsIServiceWorkerManager.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIScrollableFrame.h"
@@ -1042,7 +1041,6 @@ NS_INTERFACE_MAP_BEGIN(nsDocShell)
   NS_INTERFACE_MAP_ENTRY(nsILinkHandler)
   NS_INTERFACE_MAP_ENTRY(nsIClipboardCommands)
   NS_INTERFACE_MAP_ENTRY(nsIDOMStorageManager)
-  NS_INTERFACE_MAP_ENTRY(nsINetworkInterceptController)
 NS_INTERFACE_MAP_END_INHERITING(nsDocLoader)
 
 ///*****************************************************************************
@@ -13923,52 +13921,6 @@ nsDocShell::MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
 #endif
 }
 
-NS_IMETHODIMP
-nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate, bool* aShouldIntercept)
-{
-  *aShouldIntercept = false;
-  nsCOMPtr swm = mozilla::services::GetServiceWorkerManager();
-  if (!swm) {
-    return NS_OK;
-  }
-
-  if (aIsNavigate) {
-    return swm->IsAvailableForURI(aURI, aShouldIntercept);
-  }
-
-  nsCOMPtr doc = GetDocument();
-  if (!doc) {
-    return NS_ERROR_NOT_AVAILABLE;
-  }
-
-  return swm->IsControlled(doc, aShouldIntercept);
-}
-
-NS_IMETHODIMP
-nsDocShell::ChannelIntercepted(nsIInterceptedChannel* aChannel)
-{
-  nsCOMPtr swm = mozilla::services::GetServiceWorkerManager();
-  if (!swm) {
-    aChannel->Cancel();
-    return NS_OK;
-  }
-
-  bool isNavigation = false;
-  nsresult rv = aChannel->GetIsNavigation(&isNavigation);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr doc;
-
-  if (!isNavigation) {
-    doc = GetDocument();
-    if (!doc) {
-      return NS_ERROR_NOT_AVAILABLE;
-    }
-  }
-
-  return swm->DispatchFetchEvent(doc, aChannel);
-}
-
 NS_IMETHODIMP
 nsDocShell::SetPaymentRequestId(const nsAString& aPaymentRequestId)
 {
diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h
index 9b5094f2715f..d1a8ad2088a1 100644
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -12,7 +12,6 @@
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIBaseWindow.h"
-#include "nsINetworkInterceptController.h"
 #include "nsIScrollable.h"
 #include "nsITextScroll.h"
 #include "nsIContentViewerContainer.h"
@@ -153,7 +152,6 @@ class nsDocShell MOZ_FINAL
   , public nsILinkHandler
   , public nsIClipboardCommands
   , public nsIDOMStorageManager
-  , public nsINetworkInterceptController
   , public mozilla::SupportsWeakPtr
 {
   friend class nsDSURIContentListener;
@@ -184,7 +182,6 @@ public:
   NS_DECL_NSIAUTHPROMPTPROVIDER
   NS_DECL_NSICLIPBOARDCOMMANDS
   NS_DECL_NSIWEBSHELLSERVICES
-  NS_DECL_NSINETWORKINTERCEPTCONTROLLER
   NS_FORWARD_SAFE_NSIDOMSTORAGEMANAGER(TopSessionStorageManager())
 
   NS_IMETHOD Stop() MOZ_OVERRIDE {
diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h
index 3cbd872af6be..2b3269416500 100644
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -622,7 +622,7 @@ protected:
     DECL_SHIM(nsIApplicationCacheContainer, NSIAPPLICATIONCACHECONTAINER)
 #undef DECL_SHIM
   };
-
+  
   /**
    * Add an ExternalResource for aURI.  aViewer and aLoadGroup might be null
    * when this is called if the URI didn't result in an XML document.  This
diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf
index 6555867e4241..3d3390fc2ac6 100644
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -418,14 +418,6 @@ DOMInterfaces = {
     'nativeType': 'mozilla::dom::workers::ExtendableEvent',
 },
 
-'FetchEvent': {
-    'headerFile': 'ServiceWorkerEvents.h',
-    'nativeType': 'mozilla::dom::workers::FetchEvent',
-    'binaryNames': {
-        'request': 'request_'
-    },
-},
-
 'FileList': {
     'headerFile': 'mozilla/dom/File.h',
 },
diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp
index ce1e7c822c55..9abbd7824c3e 100644
--- a/dom/fetch/Fetch.cpp
+++ b/dom/fetch/Fetch.cpp
@@ -866,11 +866,6 @@ FetchBody::FetchBody();
 template
 FetchBody::FetchBody();
 
-template 
-FetchBody::~FetchBody()
-{
-}
-
 // Returns true if addref succeeded.
 // Always succeeds on main thread.
 // May fail on worker if RegisterFeature() fails. In that case, it will release
diff --git a/dom/fetch/Fetch.h b/dom/fetch/Fetch.h
index 6b86f0d444af..d3090fea1a5e 100644
--- a/dom/fetch/Fetch.h
+++ b/dom/fetch/Fetch.h
@@ -135,12 +135,6 @@ public:
   void
   CancelPump();
 
-  void
-  SetBodyUsed()
-  {
-    mBodyUsed = true;
-  }
-
   // Always set whenever the FetchBody is created on the worker thread.
   workers::WorkerPrivate* mWorkerPrivate;
 
@@ -151,7 +145,15 @@ public:
 protected:
   FetchBody();
 
-  virtual ~FetchBody();
+  virtual ~FetchBody()
+  {
+  }
+
+  void
+  SetBodyUsed()
+  {
+    mBodyUsed = true;
+  }
 
   void
   SetMimeType(ErrorResult& aRv);
diff --git a/dom/interfaces/base/nsIServiceWorkerManager.idl b/dom/interfaces/base/nsIServiceWorkerManager.idl
index 2cec7919a442..acd45e9d5182 100644
--- a/dom/interfaces/base/nsIServiceWorkerManager.idl
+++ b/dom/interfaces/base/nsIServiceWorkerManager.idl
@@ -6,7 +6,6 @@
 #include "domstubs.idl"
 
 interface nsIDocument;
-interface nsIInterceptedChannel;
 interface nsIPrincipal;
 interface nsIURI;
 
@@ -19,7 +18,7 @@ interface nsIServiceWorkerUnregisterCallback : nsISupports
   [noscript] void UnregisterFailed();
 };
 
-[builtinclass, uuid(464882c8-81c0-4620-b9c4-44c12085b65b)]
+[builtinclass, uuid(861b55e9-d6ac-47cf-a528-8590e9b44de6)]
 interface nsIServiceWorkerManager : nsISupports
 {
   /**
@@ -52,15 +51,6 @@ interface nsIServiceWorkerManager : nsISupports
   // Remove ready pending Promise
   void removeReadyPromise(in nsIDOMWindow aWindow);
 
-  // Returns true if a ServiceWorker is available for the scope of aURI.
-  bool isAvailableForURI(in nsIURI aURI);
-
-  // Returns true if a given document is currently controlled by a ServiceWorker
-  bool isControlled(in nsIDocument aDocument);
-
-  // Cause a fetch event to be dispatched to the worker global associated with the given document.
-  void dispatchFetchEvent(in nsIDocument aDoc, in nsIInterceptedChannel aChannel);
-
   // aTarget MUST be a ServiceWorkerRegistration.
   [noscript] void AddRegistrationEventListener(in DOMString aScope, in nsIDOMEventTarget aTarget);
   [noscript] void RemoveRegistrationEventListener(in DOMString aScope, in nsIDOMEventTarget aTarget);
diff --git a/dom/webidl/FetchEvent.webidl b/dom/webidl/FetchEvent.webidl
deleted file mode 100644
index 20c378176743..000000000000
--- a/dom/webidl/FetchEvent.webidl
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * For more information on this interface, please see
- * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html
- */
-
-[Constructor(DOMString type, optional FetchEventInit eventInitDict),
- Func="mozilla::dom::workers::ServiceWorkerVisible",
- Exposed=(ServiceWorker)]
-interface FetchEvent : Event {
-  readonly attribute Request request;
-  readonly attribute ServiceWorkerClient client; // The window issuing the request.
-  readonly attribute boolean isReload;
-
-  [Throws] void respondWith(Promise r);
-  Promise forwardTo(USVString url);
-  Promise default();
-};
-
-dictionary FetchEventInit : EventInit {
-  Request request;
-  ServiceWorkerClient client;
-  boolean isReload;
-};
diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build
index 4cdf32fcff68..6cd53553419c 100644
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -132,7 +132,6 @@ WEBIDL_FILES = [
     'EventTarget.webidl',
     'ExtendableEvent.webidl',
     'Fetch.webidl',
-    'FetchEvent.webidl',
     'File.webidl',
     'FileList.webidl',
     'FileMode.webidl',
diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/workers/ServiceWorkerEvents.cpp
index 6199f3b5f405..2e53e4d6d598 100644
--- a/dom/workers/ServiceWorkerEvents.cpp
+++ b/dom/workers/ServiceWorkerEvents.cpp
@@ -5,20 +5,9 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ServiceWorkerEvents.h"
-#include "ServiceWorkerClient.h"
 
-#include "nsINetworkInterceptController.h"
-#include "nsIOutputStream.h"
 #include "nsContentUtils.h"
-#include "nsComponentManagerUtils.h"
-#include "nsServiceManagerUtils.h"
-#include "nsStreamUtils.h"
-#include "nsNetCID.h"
 
-#include "mozilla/dom/FetchEventBinding.h"
-#include "mozilla/dom/PromiseNativeHandler.h"
-#include "mozilla/dom/Request.h"
-#include "mozilla/dom/Response.h"
 #include "mozilla/dom/WorkerScope.h"
 #include "mozilla/dom/workers/bindings/ServiceWorker.h"
 
@@ -26,271 +15,6 @@ using namespace mozilla::dom;
 
 BEGIN_WORKERS_NAMESPACE
 
-FetchEvent::FetchEvent(EventTarget* aOwner)
-: Event(aOwner, nullptr, nullptr)
-, mWindowId(0)
-, mIsReload(false)
-, mWaitToRespond(false)
-{
-}
-
-FetchEvent::~FetchEvent()
-{
-}
-
-void
-FetchEvent::PostInit(nsMainThreadPtrHandle& aChannel,
-                     nsMainThreadPtrHandle& aServiceWorker,
-                     uint64_t aWindowId)
-{
-  mChannel = aChannel;
-  mServiceWorker = aServiceWorker;
-  mWindowId = aWindowId;
-}
-
-/*static*/ already_AddRefed
-FetchEvent::Constructor(const GlobalObject& aGlobal,
-                        const nsAString& aType,
-                        const FetchEventInit& aOptions,
-                        ErrorResult& aRv)
-{
-  nsRefPtr owner = do_QueryObject(aGlobal.GetAsSupports());
-  MOZ_ASSERT(owner);
-  nsRefPtr e = new FetchEvent(owner);
-  bool trusted = e->Init(owner);
-  e->InitEvent(aType, aOptions.mBubbles, aOptions.mCancelable);
-  e->SetTrusted(trusted);
-  e->mRequest = aOptions.mRequest.WasPassed() ?
-      &aOptions.mRequest.Value() : nullptr;
-  e->mIsReload = aOptions.mIsReload.WasPassed() ?
-      aOptions.mIsReload.Value() : false;
-  e->mClient = aOptions.mClient.WasPassed() ?
-      &aOptions.mClient.Value() : nullptr;
-  return e.forget();
-}
-
-namespace {
-
-class CancelChannelRunnable MOZ_FINAL : public nsRunnable
-{
-  nsMainThreadPtrHandle mChannel;
-public:
-  explicit CancelChannelRunnable(nsMainThreadPtrHandle& aChannel)
-    : mChannel(aChannel)
-  {
-  }
-
-  NS_IMETHOD Run()
-  {
-    MOZ_ASSERT(NS_IsMainThread());
-    nsresult rv = mChannel->Cancel();
-    NS_ENSURE_SUCCESS(rv, rv);
-    return NS_OK;
-  }
-};
-
-class FinishResponse MOZ_FINAL : public nsRunnable
-{
-  nsMainThreadPtrHandle mChannel;
-public:
-  explicit FinishResponse(nsMainThreadPtrHandle& aChannel)
-    : mChannel(aChannel)
-  {
-  }
-
-  NS_IMETHOD
-      Run()
-  {
-    AssertIsOnMainThread();
-    nsresult rv = mChannel->FinishSynthesizedResponse();
-    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to finish synthesized response");
-    return rv;
-  }
-};
-
-class RespondWithHandler MOZ_FINAL : public PromiseNativeHandler
-{
-  nsMainThreadPtrHandle mInterceptedChannel;
-  nsMainThreadPtrHandle mServiceWorker;
-public:
-  RespondWithHandler(nsMainThreadPtrHandle& aChannel,
-                     nsMainThreadPtrHandle& aServiceWorker)
-    : mInterceptedChannel(aChannel)
-    , mServiceWorker(aServiceWorker)
-  {
-  }
-
-  void ResolvedCallback(JSContext* aCx, JS::Handle aValue) MOZ_OVERRIDE;
-
-  void RejectedCallback(JSContext* aCx, JS::Handle aValue) MOZ_OVERRIDE;
-
-  void CancelRequest();
-};
-
-struct RespondWithClosure
-{
-  nsMainThreadPtrHandle mInterceptedChannel;
-
-  explicit RespondWithClosure(nsMainThreadPtrHandle& aChannel)
-    : mInterceptedChannel(aChannel)
-  {
-  }
-};
-
-void RespondWithCopyComplete(void* aClosure, nsresult aStatus)
-{
-  nsAutoPtr data(static_cast(aClosure));
-  nsCOMPtr event;
-  if (NS_SUCCEEDED(aStatus)) {
-    event = new FinishResponse(data->mInterceptedChannel);
-  } else {
-    event = new CancelChannelRunnable(data->mInterceptedChannel);
-  }
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(event)));
-}
-
-class MOZ_STACK_CLASS AutoCancel
-{
-  nsRefPtr mOwner;
-
-public:
-  explicit AutoCancel(RespondWithHandler* aOwner)
-    : mOwner(aOwner)
-  {
-  }
-
-  ~AutoCancel()
-  {
-    if (mOwner) {
-      mOwner->CancelRequest();
-    }
-  }
-
-  void Reset()
-  {
-    mOwner = nullptr;
-  }
-};
-
-void
-RespondWithHandler::ResolvedCallback(JSContext* aCx, JS::Handle aValue)
-{
-  AutoCancel autoCancel(this);
-
-  if (!aValue.isObject()) {
-    return;
-  }
-
-  nsRefPtr response;
-  nsresult rv = UNWRAP_OBJECT(Response, &aValue.toObject(), response);
-  if (NS_FAILED(rv)) {
-    return;
-  }
-
-  nsCOMPtr body;
-  response->GetBody(getter_AddRefs(body));
-  if (NS_WARN_IF(!body) || NS_WARN_IF(response->BodyUsed())) {
-    return;
-  }
-  response->SetBodyUsed();
-
-  nsCOMPtr responseBody;
-  rv = mInterceptedChannel->GetResponseBody(getter_AddRefs(responseBody));
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return;
-  }
-
-  nsAutoPtr closure(new RespondWithClosure(mInterceptedChannel));
-
-  nsCOMPtr stsThread = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);
-  if (NS_WARN_IF(!stsThread)) {
-    return;
-  }
-  rv = NS_AsyncCopy(body, responseBody, stsThread, NS_ASYNCCOPY_VIA_READSEGMENTS, 4096,
-                    RespondWithCopyComplete, closure.forget());
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return;
-  }
-
-  autoCancel.Reset();
-}
-
-void
-RespondWithHandler::RejectedCallback(JSContext* aCx, JS::Handle aValue)
-{
-  CancelRequest();
-}
-
-void
-RespondWithHandler::CancelRequest()
-{
-  nsCOMPtr runnable = new CancelChannelRunnable(mInterceptedChannel);
-  NS_DispatchToMainThread(runnable);
-}
-
-} // anonymous namespace
-
-void
-FetchEvent::RespondWith(Promise& aPromise, ErrorResult& aRv)
-{
-  if (mWaitToRespond) {
-    aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
-    return;
-  }
-
-  mWaitToRespond = true;
-  nsRefPtr handler = new RespondWithHandler(mChannel, mServiceWorker);
-  aPromise.AppendNativeHandler(handler);
-}
-
-already_AddRefed
-FetchEvent::Client()
-{
-  if (!mClient) {
-    mClient = new ServiceWorkerClient(GetParentObject(), mWindowId);
-  }
-  nsRefPtr client = mClient;
-  return client.forget();
-}
-
-already_AddRefed
-FetchEvent::ForwardTo(const nsAString& aUrl)
-{
-  nsCOMPtr global = do_QueryInterface(GetParentObject());
-  MOZ_ASSERT(global);
-  ErrorResult result;
-  nsRefPtr promise = Promise::Create(global, result);
-  if (NS_WARN_IF(result.Failed())) {
-    return nullptr;
-  }
-
-  promise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
-  return promise.forget();
-}
-
-already_AddRefed
-FetchEvent::Default()
-{
-  nsCOMPtr global = do_QueryInterface(GetParentObject());
-  MOZ_ASSERT(global);
-  ErrorResult result;
-  nsRefPtr promise = Promise::Create(global, result);
-  if (result.Failed()) {
-    return nullptr;
-  }
-
-  promise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
-  return promise.forget();
-}
-
-NS_IMPL_ADDREF_INHERITED(FetchEvent, Event)
-NS_IMPL_RELEASE_INHERITED(FetchEvent, Event)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FetchEvent)
-NS_INTERFACE_MAP_END_INHERITING(Event)
-
-NS_IMPL_CYCLE_COLLECTION_INHERITED(FetchEvent, Event, mRequest, mClient)
-
 ExtendableEvent::ExtendableEvent(EventTarget* aOwner)
   : Event(aOwner, nullptr, nullptr)
 {
diff --git a/dom/workers/ServiceWorkerEvents.h b/dom/workers/ServiceWorkerEvents.h
index 7a20cc87995c..04f30ccef88c 100644
--- a/dom/workers/ServiceWorkerEvents.h
+++ b/dom/workers/ServiceWorkerEvents.h
@@ -8,87 +8,12 @@
 
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/ExtendableEventBinding.h"
-#include "mozilla/dom/FetchEventBinding.h"
 #include "mozilla/dom/InstallEventBinding.h"
 #include "mozilla/dom/Promise.h"
-#include "nsProxyRelease.h"
-
-class nsIInterceptedChannel;
-
-namespace mozilla {
-namespace dom {
-  class Request;
-} // namespace dom
-} // namespace mozilla
 
 BEGIN_WORKERS_NAMESPACE
 
 class ServiceWorker;
-class ServiceWorkerClient;
-
-class FetchEvent MOZ_FINAL : public Event
-{
-  nsMainThreadPtrHandle mChannel;
-  nsMainThreadPtrHandle mServiceWorker;
-  nsRefPtr mClient;
-  nsRefPtr mRequest;
-  uint64_t mWindowId;
-  bool mIsReload;
-  bool mWaitToRespond;
-protected:
-  explicit FetchEvent(EventTarget* aOwner);
-  ~FetchEvent();
-
-public:
-  NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FetchEvent, Event)
-  NS_FORWARD_TO_EVENT
-
-  virtual JSObject* WrapObjectInternal(JSContext* aCx) MOZ_OVERRIDE
-  {
-    return FetchEventBinding::Wrap(aCx, this);
-  }
-
-  void PostInit(nsMainThreadPtrHandle& aChannel,
-                nsMainThreadPtrHandle& aServiceWorker,
-                uint64_t aWindowId);
-
-  static already_AddRefed
-  Constructor(const GlobalObject& aGlobal,
-              const nsAString& aType,
-              const FetchEventInit& aOptions,
-              ErrorResult& aRv);
-
-  bool
-  WaitToRespond() const
-  {
-    return mWaitToRespond;
-  }
-
-  Request*
-  Request_() const
-  {
-    return mRequest;
-  }
-
-  already_AddRefed
-  Client();
-
-  bool
-  IsReload() const
-  {
-    return mIsReload;
-  }
-
-  void
-  RespondWith(Promise& aPromise, ErrorResult& aRv);
-
-  already_AddRefed
-  ForwardTo(const nsAString& aUrl);
-
-  already_AddRefed
-  Default();
-};
 
 class ExtendableEvent : public Event
 {
diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp
index 208a8144d055..c1dd85644f23 100644
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -11,10 +11,7 @@
 #include "nsIStreamLoader.h"
 #include "nsIHttpChannel.h"
 #include "nsIHttpChannelInternal.h"
-#include "nsIHttpHeaderVisitor.h"
-#include "nsINetworkInterceptController.h"
 #include "nsPIDOMWindow.h"
-#include "nsDebug.h"
 
 #include "jsapi.h"
 
@@ -22,13 +19,9 @@
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/DOMError.h"
 #include "mozilla/dom/ErrorEvent.h"
-#include "mozilla/dom/Headers.h"
 #include "mozilla/dom/InstallEventBinding.h"
-#include "mozilla/dom/InternalHeaders.h"
 #include "mozilla/dom/Navigator.h"
 #include "mozilla/dom/PromiseNativeHandler.h"
-#include "mozilla/dom/Request.h"
-#include "mozilla/dom/RootedDictionary.h"
 #include "mozilla/ipc/BackgroundChild.h"
 #include "mozilla/ipc/PBackgroundChild.h"
 #include "mozilla/ipc/PBackgroundSharedTypes.h"
@@ -2128,267 +2121,6 @@ ServiceWorkerManager::GetServiceWorkerForScope(nsIDOMWindow* aWindow,
   return NS_OK;
 }
 
-class FetchEventRunnable : public WorkerRunnable
-                         , public nsIHttpHeaderVisitor {
-  nsMainThreadPtrHandle mInterceptedChannel;
-  nsMainThreadPtrHandle mServiceWorker;
-  nsTArray mHeaderNames;
-  nsTArray mHeaderValues;
-  uint64_t mWindowId;
-  nsCString mSpec;
-  nsCString mMethod;
-  bool mIsReload;
-public:
-  FetchEventRunnable(WorkerPrivate* aWorkerPrivate,
-                     nsMainThreadPtrHandle& aChannel,
-                     nsMainThreadPtrHandle& aServiceWorker,
-                     uint64_t aWindowId)
-    : WorkerRunnable(aWorkerPrivate, WorkerThreadModifyBusyCount)
-    , mInterceptedChannel(aChannel)
-    , mServiceWorker(aServiceWorker)
-    , mWindowId(aWindowId)
-  {
-    MOZ_ASSERT(aWorkerPrivate);
-  }
-
-  NS_DECL_ISUPPORTS_INHERITED
-
-  NS_IMETHOD
-  VisitHeader(const nsACString& aHeader, const nsACString& aValue)
-  {
-    mHeaderNames.AppendElement(aHeader);
-    mHeaderValues.AppendElement(aValue);
-    return NS_OK;
-  }
-
-  nsresult
-  Init()
-  {
-    nsCOMPtr channel;
-    nsresult rv = mInterceptedChannel->GetChannel(getter_AddRefs(channel));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr uri;
-    rv = channel->GetURI(getter_AddRefs(uri));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = uri->GetSpec(mSpec);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr httpChannel = do_QueryInterface(channel);
-    NS_ENSURE_TRUE(httpChannel, NS_ERROR_NOT_AVAILABLE);
-
-    rv = httpChannel->GetRequestMethod(mMethod);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    uint32_t loadFlags;
-    rv = channel->GetLoadFlags(&loadFlags);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    //TODO(jdm): we should probably include reload-ness in the loadinfo or as a separate load flag
-    mIsReload = false;
-
-    rv = httpChannel->VisitRequestHeaders(this);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    return NS_OK;
-  }
-
-  bool
-  WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
-  {
-    MOZ_ASSERT(aWorkerPrivate);
-    return DispatchFetchEvent(aCx, aWorkerPrivate);
-  }
-
-private:
-  ~FetchEventRunnable() {}
-
-  class ResumeRequest MOZ_FINAL : public nsRunnable {
-    nsMainThreadPtrHandle mChannel;
-  public:
-    explicit ResumeRequest(nsMainThreadPtrHandle& aChannel)
-      : mChannel(aChannel)
-    {
-    }
-
-    NS_IMETHOD Run()
-    {
-      AssertIsOnMainThread();
-      nsresult rv = mChannel->ResetInterception();
-      NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to resume intercepted network request");
-      return rv;
-    }
-  };
-
-  bool
-  DispatchFetchEvent(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
-  {
-    MOZ_ASSERT(aCx);
-    MOZ_ASSERT(aWorkerPrivate);
-    MOZ_ASSERT(aWorkerPrivate->IsServiceWorker());
-    GlobalObject globalObj(aCx, aWorkerPrivate->GlobalScope()->GetWrapper());
-
-    RequestOrUSVString requestInfo;
-    *requestInfo.SetAsUSVString().ToAStringPtr() = NS_ConvertUTF8toUTF16(mSpec);
-
-    RootedDictionary reqInit(aCx);
-    reqInit.mMethod.Construct(mMethod);
-
-    nsRefPtr internalHeaders = new InternalHeaders(HeadersGuardEnum::Request);
-    MOZ_ASSERT(mHeaderNames.Length() == mHeaderValues.Length());
-    for (uint32_t i = 0; i < mHeaderNames.Length(); i++) {
-      ErrorResult rv;
-      internalHeaders->Set(mHeaderNames[i], mHeaderValues[i], rv);
-      if (NS_WARN_IF(rv.Failed())) {
-        return false;
-      }
-    }
-
-    nsRefPtr headers = new Headers(globalObj.GetAsSupports(), internalHeaders);
-    reqInit.mHeaders.Construct();
-    reqInit.mHeaders.Value().SetAsHeaders() = headers;
-
-    //TODO(jdm): set request body
-    //TODO(jdm): set request same-origin mode and credentials
-
-    ErrorResult rv;
-    nsRefPtr request = Request::Constructor(globalObj, requestInfo, reqInit, rv);
-    if (NS_WARN_IF(rv.Failed())) {
-      return false;
-    }
-
-    RootedDictionary init(aCx);
-    init.mRequest.Construct();
-    init.mRequest.Value() = request;
-    init.mBubbles = false;
-    init.mCancelable = true;
-    init.mIsReload.Construct(mIsReload);
-    nsRefPtr event =
-      FetchEvent::Constructor(globalObj, NS_LITERAL_STRING("fetch"), init, rv);
-    if (NS_WARN_IF(rv.Failed())) {
-      return false;
-    }
-
-    event->PostInit(mInterceptedChannel, mServiceWorker, mWindowId);
-    event->SetTrusted(true);
-
-    nsRefPtr target = do_QueryObject(aWorkerPrivate->GlobalScope());
-    nsresult rv2 = target->DispatchDOMEvent(nullptr, event, nullptr, nullptr);
-    if (NS_WARN_IF(NS_FAILED(rv2)) || !event->WaitToRespond()) {
-      nsCOMPtr runnable = new ResumeRequest(mInterceptedChannel);
-      MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
-    }
-    return true;
-  }
-};
-
-NS_IMPL_ISUPPORTS_INHERITED(FetchEventRunnable, WorkerRunnable, nsIHttpHeaderVisitor)
-
-NS_IMETHODIMP
-ServiceWorkerManager::DispatchFetchEvent(nsIDocument* aDoc, nsIInterceptedChannel* aChannel)
-{
-  MOZ_ASSERT(aChannel);
-  nsCOMPtr serviceWorker;
-
-  bool isNavigation = false;
-  nsresult rv = aChannel->GetIsNavigation(&isNavigation);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (!isNavigation) {
-    MOZ_ASSERT(aDoc);
-    rv = GetDocumentController(aDoc->GetWindow(), getter_AddRefs(serviceWorker));
-  } else {
-    nsCOMPtr internalChannel;
-    rv = aChannel->GetChannel(getter_AddRefs(internalChannel));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr uri;
-    rv = internalChannel->GetURI(getter_AddRefs(uri));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsRefPtr registration =
-      GetServiceWorkerRegistrationInfo(uri);
-    // This should only happen if IsAvailableForURI() returned true.
-    MOZ_ASSERT(registration);
-    MOZ_ASSERT(registration->mActiveWorker);
-
-    nsRefPtr sw;
-    rv = CreateServiceWorker(registration->mPrincipal,
-                             registration->mActiveWorker->ScriptSpec(),
-                             registration->mScope,
-                             getter_AddRefs(sw));
-    serviceWorker = sw.forget();
-  }
-
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  nsMainThreadPtrHandle handle(
-    new nsMainThreadPtrHolder(aChannel, false));
-
-  uint64_t windowId = aDoc ? aDoc->GetInnerWindow()->WindowID() : 0;
-
-  nsRefPtr sw = static_cast(serviceWorker.get());
-  nsMainThreadPtrHandle serviceWorkerHandle(
-    new nsMainThreadPtrHolder(sw));
-
-  nsRefPtr event =
-    new FetchEventRunnable(sw->GetWorkerPrivate(), handle, serviceWorkerHandle, windowId);
-  rv = event->Init();
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  AutoJSAPI api;
-  api.Init();
-  if (NS_WARN_IF(!event->Dispatch(api.cx()))) {
-    return NS_ERROR_FAILURE;
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-ServiceWorkerManager::IsAvailableForURI(nsIURI* aURI, bool* aIsAvailable)
-{
-  MOZ_ASSERT(aURI);
-  MOZ_ASSERT(aIsAvailable);
-  nsRefPtr registration =
-    GetServiceWorkerRegistrationInfo(aURI);
-  *aIsAvailable = registration && registration->mActiveWorker;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-ServiceWorkerManager::IsControlled(nsIDocument* aDoc, bool* aIsControlled)
-{
-  MOZ_ASSERT(aDoc);
-  MOZ_ASSERT(aIsControlled);
-  nsRefPtr registration;
-  nsresult rv = GetDocumentRegistration(aDoc, getter_AddRefs(registration));
-  NS_ENSURE_SUCCESS(rv, rv);
-  *aIsControlled = !!registration;
-  return NS_OK;
-}
-
-nsresult
-ServiceWorkerManager::GetDocumentRegistration(nsIDocument* aDoc,
-                                              ServiceWorkerRegistrationInfo** aRegistrationInfo)
-{
-  nsRefPtr registration;
-  if (!mControlledDocuments.Get(aDoc, getter_AddRefs(registration))) {
-    return NS_ERROR_FAILURE;
-  }
-
-  // If the document is controlled, the current worker MUST be non-null.
-  if (!registration->mActiveWorker) {
-    return NS_ERROR_NOT_AVAILABLE;
-  }
-
-  registration.forget(aRegistrationInfo);
-  return NS_OK;
-}
-
 /*
  * The .controller is for the registration associated with the document when
  * the document was loaded.
@@ -2405,16 +2137,21 @@ ServiceWorkerManager::GetDocumentController(nsIDOMWindow* aWindow, nsISupports**
   nsCOMPtr doc = window->GetExtantDoc();
 
   nsRefPtr registration;
-  nsresult rv = GetDocumentRegistration(doc, getter_AddRefs(registration));
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
+  if (!mControlledDocuments.Get(doc, getter_AddRefs(registration))) {
+    return NS_ERROR_FAILURE;
   }
 
+  // If the document is controlled, the current worker MUST be non-null.
+  if (!registration->mActiveWorker) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
+
   nsRefPtr serviceWorker;
-  rv = CreateServiceWorkerForWindow(window,
-                                    registration->mActiveWorker->ScriptSpec(),
-                                    registration->mScope,
-                                    getter_AddRefs(serviceWorker));
+  nsresult rv = CreateServiceWorkerForWindow(window,
+                                             registration->mActiveWorker->ScriptSpec(),
+                                             registration->mScope,
+                                             getter_AddRefs(serviceWorker));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
diff --git a/dom/workers/ServiceWorkerManager.h b/dom/workers/ServiceWorkerManager.h
index c5f8ff5c8b17..e642e08ed9c9 100644
--- a/dom/workers/ServiceWorkerManager.h
+++ b/dom/workers/ServiceWorkerManager.h
@@ -399,9 +399,6 @@ private:
   nsresult
   Update(ServiceWorkerRegistrationInfo* aRegistration);
 
-  nsresult
-  GetDocumentRegistration(nsIDocument* aDoc, ServiceWorkerRegistrationInfo** aRegistrationInfo);
-
   NS_IMETHOD
   CreateServiceWorkerForWindow(nsPIDOMWindow* aWindow,
                                const nsACString& aScriptSpec,
diff --git a/dom/workers/test/serviceworkers/fetch/fetch_tests.js b/dom/workers/test/serviceworkers/fetch/fetch_tests.js
deleted file mode 100644
index e6900b6860d3..000000000000
--- a/dom/workers/test/serviceworkers/fetch/fetch_tests.js
+++ /dev/null
@@ -1,54 +0,0 @@
-function fetch(name, onload, onerror, headers) {
-  expectAsyncResult();
-
-  onload = onload || function() {
-    my_ok(false, "XHR load should not complete successfully");
-    finish();
-  };
-  onerror = onerror || function() {
-    my_ok(false, "XHR load should be intercepted successfully");
-    finish();
-  };
-
-  var x = new XMLHttpRequest();
-  x.open('GET', name, true);
-  x.onload = function() { onload(x) };
-  x.onerror = function() { onerror(x) };
-  headers = headers || [];
-  headers.forEach(function(header) {
-    x.setRequestHeader(header[0], header[1]);
-  });
-  x.send();
-}
-
-fetch('synthesized.txt', function(xhr) {
-  my_ok(xhr.status == 200, "load should be successful");
-  my_ok(xhr.responseText == "synthesized response body", "load should have synthesized response");
-  finish();
-});
-
-fetch('ignored.txt', function(xhr) {
-  my_ok(xhr.status == 404, "load should be uninterrupted");
-  finish();
-});
-
-fetch('rejected.txt', null, function(xhr) {
-  my_ok(xhr.status == 0, "load should not complete");
-  finish();
-});
-
-fetch('nonresponse.txt', null, function(xhr) {
-  my_ok(xhr.status == 0, "load should not complete");
-  finish();
-});
-
-fetch('nonresponse2.txt', null, function(xhr) {
-  my_ok(xhr.status == 0, "load should not complete");
-  finish();
-});
-
-fetch('headers.txt', function(xhr) {
-  my_ok(xhr.status == 200, "load should be successful");
-  my_ok(xhr.responseText == "1", "request header checks should have passed");
-  finish();
-}, null, [["X-Test1", "header1"], ["X-Test2", "header2"]]);
diff --git a/dom/workers/test/serviceworkers/fetch/fetch_worker_script.js b/dom/workers/test/serviceworkers/fetch/fetch_worker_script.js
deleted file mode 100644
index 61efb647c8f9..000000000000
--- a/dom/workers/test/serviceworkers/fetch/fetch_worker_script.js
+++ /dev/null
@@ -1,29 +0,0 @@
-function my_ok(v, msg) {
-  postMessage({type: "ok", value: v, msg: msg});
-}
-
-function finish() {
-  postMessage('finish');
-}
-
-function expectAsyncResult() {
-  postMessage('expect');
-}
-
-expectAsyncResult();
-try {
-  var success = false;
-  importScripts("nonexistent_imported_script.js");
-} catch(x) {
-}
-
-my_ok(success, "worker imported script should be intercepted");
-finish();
-
-function check_intercepted_script() {
-  success = true;
-}
-
-importScripts('fetch_tests.js')
-
-finish(); //corresponds to the gExpected increment before creating this worker
diff --git a/dom/workers/test/serviceworkers/fetch/index.html b/dom/workers/test/serviceworkers/fetch/index.html
deleted file mode 100644
index 88962f798956..000000000000
--- a/dom/workers/test/serviceworkers/fetch/index.html
+++ /dev/null
@@ -1,147 +0,0 @@
-
-
-
-
-  Bug 94048 - test install event.
-  
-  
-
-
-

- -
-

-
-
-
-
-
-
diff --git a/dom/workers/test/serviceworkers/fetch_event_worker.js b/dom/workers/test/serviceworkers/fetch_event_worker.js
deleted file mode 100644
index 107544828397..000000000000
--- a/dom/workers/test/serviceworkers/fetch_event_worker.js
+++ /dev/null
@@ -1,86 +0,0 @@
-onfetch = function(ev) {
-  if (ev.request.url.contains("synthesized.txt")) {
-    var p = new Promise(function(resolve) {
-      var r = new Response("synthesized response body", {});
-      resolve(r);
-    });
-    ev.respondWith(p);
-  }
-
-  else if (ev.request.url.contains("ignored.txt")) {
-  }
-
-  else if (ev.request.url.contains("rejected.txt")) {
-    var p = new Promise(function(resolve, reject) {
-      reject();
-    });
-    ev.respondWith(p);
-  }
-
-  else if (ev.request.url.contains("nonresponse.txt")) {
-    var p = new Promise(function(resolve, reject) {
-      resolve(5);
-    });
-    ev.respondWith(p);
-  }
-
-  else if (ev.request.url.contains("nonresponse2.txt")) {
-    var p = new Promise(function(resolve, reject) {
-      resolve({});
-    });
-    ev.respondWith(p);
-  }
-
-  else if (ev.request.url.contains("headers.txt")) {
-    var p = new Promise(function(resolve, reject) {
-      var ok = true;
-      ok &= ev.request.headers.get("X-Test1") == "header1";
-      ok &= ev.request.headers.get("X-Test2") == "header2";
-      var r = new Response(ok.toString(), {});
-      resolve(r);
-    });
-    ev.respondWith(p);    
-  }
-
-  else if (ev.request.url.contains("nonexistent_image.gif")) {
-    var p = new Promise(function(resolve, reject) {
-      resolve(new Response(atob("R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs"), {}));
-    });
-    ev.respondWith(p);
-  }
-
-  else if (ev.request.url.contains("nonexistent_script.js")) {
-    var p = new Promise(function(resolve, reject) {
-      resolve(new Response("check_intercepted_script();", {}));
-    });
-    ev.respondWith(p);
-  }
-
-  else if (ev.request.url.contains("nonexistent_stylesheet.css")) {
-    var p = new Promise(function(resolve, reject) {
-      resolve(new Response("#style-test { background-color: black !important; }", {}));
-    });
-    ev.respondWith(p);
-  }
-
-  else if (ev.request.url.contains("nonexistent_page.html")) {
-    var p = new Promise(function(resolve, reject) {
-      resolve(new Response("", {}));
-    });
-    ev.respondWith(p);
-  }
-
-  else if (ev.request.url.contains("nonexistent_worker_script.js")) {
-    var p = new Promise(function(resolve, reject) {
-      resolve(new Response("postMessage('worker-intercept-success')", {}));
-    });
-    ev.respondWith(p);
-  }
-
-  else if (ev.request.url.contains("nonexistent_imported_script.js")) {
-    var p = new Promise(function(resolve, reject) {
-      resolve(new Response("check_intercepted_script();", {}));
-    });
-    ev.respondWith(p);
-  }
-}
diff --git a/dom/workers/test/serviceworkers/mochitest.ini b/dom/workers/test/serviceworkers/mochitest.ini
index 074cba12d1d7..edc7d06c7420 100644
--- a/dom/workers/test/serviceworkers/mochitest.ini
+++ b/dom/workers/test/serviceworkers/mochitest.ini
@@ -4,7 +4,6 @@ support-files =
   worker.js
   worker2.js
   worker3.js
-  fetch_event_worker.js
   parse_error_worker.js
   activate_event_error_worker.js
   install_event_worker.js
@@ -21,14 +20,10 @@ support-files =
   worker_unregister.js
   worker_update.js
   message_posting_worker.js
-  fetch/index.html
-  fetch/fetch_worker_script.js
-  fetch/fetch_tests.js
 
 [test_unregister.html]
 skip-if = true # Bug 1133805
 [test_installation_simple.html]
-[test_fetch_event.html]
 [test_get_serviced.html]
 [test_install_event.html]
 [test_navigator.html]
diff --git a/dom/workers/test/serviceworkers/test_fetch_event.html b/dom/workers/test/serviceworkers/test_fetch_event.html
deleted file mode 100644
index 090e6e4faf68..000000000000
--- a/dom/workers/test/serviceworkers/test_fetch_event.html
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-  Bug 94048 - test install event.
-  
-  
-
-
-

- -

-
-
-
-
-
diff --git a/netwerk/base/nsINetworkInterceptController.idl b/netwerk/base/nsINetworkInterceptController.idl
index 576082c24557..766e2cd9266a 100644
--- a/netwerk/base/nsINetworkInterceptController.idl
+++ b/netwerk/base/nsINetworkInterceptController.idl
@@ -5,7 +5,7 @@
 
 #include "nsISupports.idl"
 
-interface nsIChannel;
+interface nsIHttpChannelInternal;
 interface nsIOutputStream;
 interface nsIURI;
 
@@ -16,7 +16,7 @@ interface nsIURI;
  * which do not implement nsIChannel.
  */
 
-[scriptable, uuid(9d127b63-dfad-484d-a0e1-cb82697a095b)]
+[scriptable, uuid(0b5f82a7-5824-4a0d-bf5c-8a8a7684c0c8)]
 interface nsIInterceptedChannel : nsISupports
 {
     /**
@@ -37,28 +37,6 @@ interface nsIInterceptedChannel : nsISupports
      * after this point.
      */
     void finishSynthesizedResponse();
-
-    /**
-     * Cancel the pending intercepted request.
-     * @return NS_ERROR_FAILURE if the response has already been synthesized or
-     *         the original request has been instructed to continue.
-     */
-    void cancel();
-
-    /**
-     * The synthesized response body to be produced.
-     */
-    readonly attribute nsIOutputStream responseBody;
-
-    /**
-     * The underlying channel object that was intercepted.
-     */
-    readonly attribute nsIChannel channel;
-
-    /**
-     * True if the underlying request was caused by a navigation attempt.
-     */
-    readonly attribute bool isNavigation;
 };
 
 /**
@@ -67,7 +45,7 @@ interface nsIInterceptedChannel : nsISupports
  * request should be intercepted before any network request is initiated.
  */
 
-[scriptable, uuid(69150b77-b561-43a2-bfba-7301dd5a35d0)]
+[scriptable, uuid(b3ad3e9b-91d8-44d0-a0c5-dc2e9374f599)]
 interface nsINetworkInterceptController : nsISupports
 {
     /**
@@ -75,15 +53,15 @@ interface nsINetworkInterceptController : nsISupports
      * requests until specifically instructed to do so.
      *
      * @param aURI the URI being requested by a channel
-     * @param aIsNavigate True if the request is for a navigation, false for a fetch.
      */
-    bool shouldPrepareForIntercept(in nsIURI aURI, in bool aIsNavigate);
+    bool shouldPrepareForIntercept(in nsIURI aURI);
 
     /**
      * Notification when a given intercepted channel is prepared to accept a synthesized
      * response via the provided stream.
      *
      * @param aChannel the controlling interface for a channel that has been intercepted
+     * @param aStream a stream directly into the channel's synthesized response body
      */
-    void channelIntercepted(in nsIInterceptedChannel aChannel);
+    void channelIntercepted(in nsIInterceptedChannel aChannel, in nsIOutputStream aStream);
 };
diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp
index 69a3594179e0..a8786f2c6ed6 100644
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -1933,12 +1933,6 @@ HttpBaseChannel::GetURIPrincipal()
   return mPrincipal;
 }
 
-bool
-HttpBaseChannel::IsNavigation()
-{
-  return mLoadFlags & LOAD_DOCUMENT_URI;
-}
-
 bool
 HttpBaseChannel::ShouldIntercept()
 {
@@ -1946,9 +1940,7 @@ HttpBaseChannel::ShouldIntercept()
   GetCallback(controller);
   bool shouldIntercept = false;
   if (controller && !mForceNoIntercept) {
-    nsresult rv = controller->ShouldPrepareForIntercept(mURI,
-                                                        IsNavigation(),
-                                                        &shouldIntercept);
+    nsresult rv = controller->ShouldPrepareForIntercept(mURI, &shouldIntercept);
     NS_ENSURE_SUCCESS(rv, false);
   }
   return shouldIntercept;
diff --git a/netwerk/protocol/http/HttpBaseChannel.h b/netwerk/protocol/http/HttpBaseChannel.h
index de7d0ba26553..a26bc2df96e6 100644
--- a/netwerk/protocol/http/HttpBaseChannel.h
+++ b/netwerk/protocol/http/HttpBaseChannel.h
@@ -241,7 +241,7 @@ public:
     const NetAddr& GetPeerAddr() { return mPeerAddr; }
 
 public: /* Necko internal use only... */
-    bool IsNavigation();
+
 
     // Return whether upon a redirect code of httpStatus for method, the
     // request method should be rewritten to GET.
diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp
index 944894343dac..741d0e4ae007 100644
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -56,111 +56,6 @@ static_assert(FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE == 250,
 
 }
 
-// A stream listener interposed between the nsInputStreamPump used for intercepted channels
-// and this channel's original listener. This is only used to ensure the original listener
-// sees the channel as the request object, and to synthesize OnStatus and OnProgress notifications.
-class InterceptStreamListener : public nsIStreamListener
-                              , public nsIProgressEventSink
-{
-  nsRefPtr mOwner;
-  nsCOMPtr mContext;
-  virtual ~InterceptStreamListener() {}
- public:
-  InterceptStreamListener(HttpChannelChild* aOwner, nsISupports* aContext)
-  : mOwner(aOwner)
-  , mContext(aContext)
-  {
-  }
-
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIREQUESTOBSERVER
-  NS_DECL_NSISTREAMLISTENER
-  NS_DECL_NSIPROGRESSEVENTSINK
-
-  void Cleanup();
-};
-
-NS_IMPL_ISUPPORTS(InterceptStreamListener,
-                  nsIStreamListener,
-                  nsIRequestObserver,
-                  nsIProgressEventSink)
-
-NS_IMETHODIMP
-InterceptStreamListener::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
-{
-  if (mOwner) {
-    mOwner->DoOnStartRequest(mOwner, mContext);
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-InterceptStreamListener::OnStatus(nsIRequest* aRequest, nsISupports* aContext,
-                                  nsresult status, const char16_t* aStatusArg)
-{
-  if (mOwner) {
-    mOwner->DoOnStatus(mOwner, status);
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-InterceptStreamListener::OnProgress(nsIRequest* aRequest, nsISupports* aContext,
-                                    int64_t aProgress, int64_t aProgressMax)
-{
-  if (mOwner) {
-    mOwner->DoOnProgress(mOwner, aProgress, aProgressMax);
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-InterceptStreamListener::OnDataAvailable(nsIRequest* aRequest, nsISupports* aContext,
-                                         nsIInputStream* aInputStream, uint64_t aOffset,
-                                         uint32_t aCount)
-{
-  if (!mOwner) {
-    return NS_OK;
-  }
-
-  uint32_t loadFlags;
-  mOwner->GetLoadFlags(&loadFlags);
-
-  if (!(loadFlags & HttpBaseChannel::LOAD_BACKGROUND)) {
-    nsCOMPtr uri;
-    mOwner->GetURI(getter_AddRefs(uri));
-
-    nsAutoCString host;
-    uri->GetHost(host);
-
-    OnStatus(mOwner, aContext, NS_NET_STATUS_READING, NS_ConvertUTF8toUTF16(host).get());
-
-    int64_t progress = aOffset + aCount;
-    OnProgress(mOwner, aContext, progress, mOwner->GetResponseHead()->ContentLength());
-  }
-
-  mOwner->DoOnDataAvailable(mOwner, mContext, aInputStream, aOffset, aCount);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-InterceptStreamListener::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext, nsresult aStatusCode)
-{
-  if (mOwner) {
-    mOwner->DoPreOnStopRequest(aStatusCode);
-    mOwner->DoOnStopRequest(mOwner, mContext);
-  }
-  Cleanup();
-  return NS_OK;
-}
-
-void
-InterceptStreamListener::Cleanup()
-{
-  mOwner = nullptr;
-  mContext = nullptr;
-}
-
 //-----------------------------------------------------------------------------
 // HttpChannelChild
 //-----------------------------------------------------------------------------
@@ -957,10 +852,6 @@ HttpChannelChild::DoNotifyListenerCleanup()
   LOG(("HttpChannelChild::DoNotifyListenerCleanup [this=%p]\n", this));
   if (mIPCOpen)
     PHttpChannelChild::Send__delete__(this);
-  if (mInterceptListener) {
-    mInterceptListener->Cleanup();
-    mInterceptListener = nullptr;
-  }
 }
 
 class DeleteSelfEvent : public ChannelEvent
@@ -1346,10 +1237,6 @@ HttpChannelChild::Cancel(nsresult status)
     mStatus = status;
     if (RemoteChannelExists())
       SendCancel(status);
-    if (mSynthesizedResponsePump) {
-      mSynthesizedResponsePump->Cancel(status);
-    }
-    mInterceptListener = nullptr;
   }
   return NS_OK;
 }
@@ -1456,6 +1343,89 @@ HttpChannelChild::GetSecurityInfo(nsISupports **aSecurityInfo)
   return NS_OK;
 }
 
+// A stream listener interposed between the nsInputStreamPump used for intercepted channels
+// and this channel's original listener. This is only used to ensure the original listener
+// sees the channel as the request object, and to synthesize OnStatus and OnProgress notifications.
+class InterceptStreamListener : public nsIStreamListener
+                              , public nsIProgressEventSink
+{
+  nsRefPtr mOwner;
+  nsCOMPtr mContext;
+  virtual ~InterceptStreamListener() {}
+public:
+  InterceptStreamListener(HttpChannelChild* aOwner, nsISupports* aContext)
+  : mOwner(aOwner)
+  , mContext(aContext)
+  {
+  }
+
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIREQUESTOBSERVER
+  NS_DECL_NSISTREAMLISTENER
+  NS_DECL_NSIPROGRESSEVENTSINK
+};
+
+NS_IMPL_ISUPPORTS(InterceptStreamListener,
+                  nsIStreamListener,
+                  nsIRequestObserver,
+                  nsIProgressEventSink)
+
+NS_IMETHODIMP
+InterceptStreamListener::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
+{
+  mOwner->DoOnStartRequest(mOwner, mContext);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+InterceptStreamListener::OnStatus(nsIRequest* aRequest, nsISupports* aContext,
+                                  nsresult status, const char16_t* aStatusArg)
+{
+  mOwner->DoOnStatus(mOwner, status);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+InterceptStreamListener::OnProgress(nsIRequest* aRequest, nsISupports* aContext,
+                                    int64_t aProgress, int64_t aProgressMax)
+{
+  mOwner->DoOnProgress(mOwner, aProgress, aProgressMax);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+InterceptStreamListener::OnDataAvailable(nsIRequest* aRequest, nsISupports* aContext,
+                                         nsIInputStream* aInputStream, uint64_t aOffset,
+                                         uint32_t aCount)
+{
+  uint32_t loadFlags;
+  mOwner->GetLoadFlags(&loadFlags);
+
+  if (!(loadFlags & HttpBaseChannel::LOAD_BACKGROUND)) {
+    nsCOMPtr uri;
+    mOwner->GetURI(getter_AddRefs(uri));
+
+    nsAutoCString host;
+    uri->GetHost(host);
+
+    OnStatus(mOwner, aContext, NS_NET_STATUS_READING, NS_ConvertUTF8toUTF16(host).get());
+
+    int64_t progress = aOffset + aCount;
+    OnProgress(mOwner, aContext, progress, mOwner->GetResponseHead()->ContentLength());
+  }
+
+  mOwner->DoOnDataAvailable(mOwner, mContext, aInputStream, aOffset, aCount);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+InterceptStreamListener::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext, nsresult aStatusCode)
+{
+  mOwner->DoPreOnStopRequest(aStatusCode);
+  mOwner->DoOnStopRequest(mOwner, mContext);
+  return NS_OK;
+}
+
 NS_IMETHODIMP
 HttpChannelChild::AsyncOpen(nsIStreamListener *listener, nsISupports *aContext)
 {
@@ -2073,7 +2043,6 @@ HttpChannelChild::DivertToParent(ChannelDiverterChild **aChild)
 void
 HttpChannelChild::ResetInterception()
 {
-  mInterceptListener->Cleanup();
   mInterceptListener = nullptr;
 
   // Continue with the original cross-process request
@@ -2082,7 +2051,7 @@ HttpChannelChild::ResetInterception()
 }
 
 void
-HttpChannelChild::OverrideWithSynthesizedResponse(nsAutoPtr& aResponseHead,
+HttpChannelChild::OverrideWithSynthesizedResponse(nsHttpResponseHead* aResponseHead,
                                                   nsInputStreamPump* aPump)
 {
   mSynthesizedResponsePump = aPump;
@@ -2094,10 +2063,6 @@ HttpChannelChild::OverrideWithSynthesizedResponse(nsAutoPtr&
     nsresult rv = mSynthesizedResponsePump->Suspend();
     NS_ENSURE_SUCCESS_VOID(rv);
   }
-
-  if (mCanceled) {
-    mSynthesizedResponsePump->Cancel(mStatus);
-  }
 }
 
 }} // mozilla::net
diff --git a/netwerk/protocol/http/HttpChannelChild.h b/netwerk/protocol/http/HttpChannelChild.h
index 4bca9eaa1282..53857a54169a 100644
--- a/netwerk/protocol/http/HttpChannelChild.h
+++ b/netwerk/protocol/http/HttpChannelChild.h
@@ -159,7 +159,7 @@ private:
 
   // Override this channel's pending response with a synthesized one. The content will be
   // asynchronously read from the pump.
-  void OverrideWithSynthesizedResponse(nsAutoPtr& aResponseHead, nsInputStreamPump* aPump);
+  void OverrideWithSynthesizedResponse(nsHttpResponseHead* aResponseHead, nsInputStreamPump* aPump);
 
   RequestHeaderTuples mClientSetRequestHeaders;
   nsCOMPtr mRedirectChannelChild;
diff --git a/netwerk/protocol/http/InterceptedChannel.cpp b/netwerk/protocol/http/InterceptedChannel.cpp
index 9cc4ead8b476..7f5f8e38ad14 100644
--- a/netwerk/protocol/http/InterceptedChannel.cpp
+++ b/netwerk/protocol/http/InterceptedChannel.cpp
@@ -26,10 +26,8 @@ DoAddCacheEntryHeaders(nsHttpChannel *self,
 
 NS_IMPL_ISUPPORTS(InterceptedChannelBase, nsIInterceptedChannel)
 
-InterceptedChannelBase::InterceptedChannelBase(nsINetworkInterceptController* aController,
-                                               bool aIsNavigation)
+InterceptedChannelBase::InterceptedChannelBase(nsINetworkInterceptController* aController)
 : mController(aController)
-, mIsNavigation(aIsNavigation)
 {
 }
 
@@ -37,36 +35,21 @@ InterceptedChannelBase::~InterceptedChannelBase()
 {
 }
 
-NS_IMETHODIMP
-InterceptedChannelBase::GetResponseBody(nsIOutputStream** aStream)
-{
-  NS_IF_ADDREF(*aStream = mResponseBody);
-  return NS_OK;
-}
-
 void
 InterceptedChannelBase::EnsureSynthesizedResponse()
 {
   if (mSynthesizedResponseHead.isNothing()) {
-    mSynthesizedResponseHead.emplace(new nsHttpResponseHead());
+    mSynthesizedResponseHead.emplace();
   }
 }
 
 void
-InterceptedChannelBase::DoNotifyController()
+InterceptedChannelBase::DoNotifyController(nsIOutputStream* aOut)
 {
-    nsresult rv = mController->ChannelIntercepted(this);
-    mController = nullptr;
+    nsresult rv = mController->ChannelIntercepted(this, aOut);
     NS_ENSURE_SUCCESS_VOID(rv);
 }
 
-NS_IMETHODIMP
-InterceptedChannelBase::GetIsNavigation(bool* aIsNavigation)
-{
-  *aIsNavigation = mIsNavigation;
-  return NS_OK;
-}
-
 nsresult
 InterceptedChannelBase::DoSynthesizeHeader(const nsACString& aName, const nsACString& aValue)
 {
@@ -74,7 +57,7 @@ InterceptedChannelBase::DoSynthesizeHeader(const nsACString& aName, const nsACSt
 
     nsAutoCString header = aName + NS_LITERAL_CSTRING(": ") + aValue;
     // Overwrite any existing header.
-    nsresult rv = (*mSynthesizedResponseHead)->ParseHeaderLine(header.get());
+    nsresult rv = mSynthesizedResponseHead->ParseHeaderLine(header.get());
     NS_ENSURE_SUCCESS(rv, rv);
     return NS_OK;
 }
@@ -82,7 +65,7 @@ InterceptedChannelBase::DoSynthesizeHeader(const nsACString& aName, const nsACSt
 InterceptedChannelChrome::InterceptedChannelChrome(nsHttpChannel* aChannel,
                                                    nsINetworkInterceptController* aController,
                                                    nsICacheEntry* aEntry)
-: InterceptedChannelBase(aController, aChannel->IsNavigation())
+: InterceptedChannelBase(aController)
 , mChannel(aChannel)
 , mSynthesizedCacheEntry(aEntry)
 {
@@ -93,17 +76,10 @@ InterceptedChannelChrome::NotifyController()
 {
   nsCOMPtr out;
 
-  nsresult rv = mSynthesizedCacheEntry->OpenOutputStream(0, getter_AddRefs(mResponseBody));
+  nsresult rv = mSynthesizedCacheEntry->OpenOutputStream(0, getter_AddRefs(out));
   NS_ENSURE_SUCCESS_VOID(rv);
 
-  DoNotifyController();
-}
-
-NS_IMETHODIMP
-InterceptedChannelChrome::GetChannel(nsIChannel** aChannel)
-{
-  NS_IF_ADDREF(*aChannel = mChannel);
-  return NS_OK;
+  DoNotifyController(out);
 }
 
 NS_IMETHODIMP
@@ -156,7 +132,7 @@ InterceptedChannelChrome::FinishSynthesizedResponse()
 
   rv = DoAddCacheEntryHeaders(mChannel, mSynthesizedCacheEntry,
                               mChannel->GetRequestHead(),
-                              mSynthesizedResponseHead.ref(), securityInfo);
+                              mSynthesizedResponseHead.ptr(), securityInfo);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr uri;
@@ -180,24 +156,10 @@ InterceptedChannelChrome::FinishSynthesizedResponse()
   return NS_OK;
 }
 
-NS_IMETHODIMP
-InterceptedChannelChrome::Cancel()
-{
-  if (!mChannel) {
-    return NS_ERROR_FAILURE;
-  }
-
-  // we need to use AsyncAbort instead of Cancel since there's no active pump
-  // to cancel which will provide OnStart/OnStopRequest to the channel.
-  nsresult rv = mChannel->AsyncAbort(NS_BINDING_ABORTED);
-  NS_ENSURE_SUCCESS(rv, rv);
-  return NS_OK;
-}
-
 InterceptedChannelContent::InterceptedChannelContent(HttpChannelChild* aChannel,
                                                      nsINetworkInterceptController* aController,
                                                      nsIStreamListener* aListener)
-: InterceptedChannelBase(aController, aChannel->IsNavigation())
+: InterceptedChannelBase(aController)
 , mChannel(aChannel)
 , mStreamListener(aListener)
 {
@@ -207,18 +169,11 @@ void
 InterceptedChannelContent::NotifyController()
 {
   nsresult rv = NS_NewPipe(getter_AddRefs(mSynthesizedInput),
-                           getter_AddRefs(mResponseBody),
+                           getter_AddRefs(mSynthesizedOutput),
                            0, UINT32_MAX, true, true);
   NS_ENSURE_SUCCESS_VOID(rv);
 
-  DoNotifyController();
-}
-
-NS_IMETHODIMP
-InterceptedChannelContent::GetChannel(nsIChannel** aChannel)
-{
-  NS_IF_ADDREF(*aChannel = mChannel);
-  return NS_OK;
+  DoNotifyController(mSynthesizedOutput);
 }
 
 NS_IMETHODIMP
@@ -228,7 +183,7 @@ InterceptedChannelContent::ResetInterception()
     return NS_ERROR_NOT_AVAILABLE;
   }
 
-  mResponseBody = nullptr;
+  mSynthesizedOutput = nullptr;
   mSynthesizedInput = nullptr;
 
   mChannel->ResetInterception();
@@ -239,7 +194,7 @@ InterceptedChannelContent::ResetInterception()
 NS_IMETHODIMP
 InterceptedChannelContent::SynthesizeHeader(const nsACString& aName, const nsACString& aValue)
 {
-  if (!mResponseBody) {
+  if (!mSynthesizedOutput) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
@@ -249,7 +204,7 @@ InterceptedChannelContent::SynthesizeHeader(const nsACString& aName, const nsACS
 NS_IMETHODIMP
 InterceptedChannelContent::FinishSynthesizedResponse()
 {
-  if (NS_WARN_IF(!mChannel)) {
+  if (!mChannel) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
@@ -257,36 +212,19 @@ InterceptedChannelContent::FinishSynthesizedResponse()
 
   nsresult rv = nsInputStreamPump::Create(getter_AddRefs(mStoragePump), mSynthesizedInput,
                                           int64_t(-1), int64_t(-1), 0, 0, true);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
+  if (NS_FAILED(rv)) {
     mSynthesizedInput->Close();
     return rv;
   }
 
-  mResponseBody = nullptr;
+  mSynthesizedOutput = nullptr;
 
   rv = mStoragePump->AsyncRead(mStreamListener, nullptr);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  mChannel->OverrideWithSynthesizedResponse(mSynthesizedResponseHead.ref(), mStoragePump);
+  mChannel->OverrideWithSynthesizedResponse(mSynthesizedResponseHead.ptr(), mStoragePump);
 
   mChannel = nullptr;
-  mStreamListener = nullptr;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-InterceptedChannelContent::Cancel()
-{
-  if (!mChannel) {
-    return NS_ERROR_FAILURE;
-  }
-
-  // we need to use AsyncAbort instead of Cancel since there's no active pump
-  // to cancel which will provide OnStart/OnStopRequest to the channel.
-  nsresult rv = mChannel->AsyncAbort(NS_BINDING_ABORTED);
-  NS_ENSURE_SUCCESS(rv, rv);
-  mChannel = nullptr;
-  mStreamListener = nullptr;
   return NS_OK;
 }
 
diff --git a/netwerk/protocol/http/InterceptedChannel.h b/netwerk/protocol/http/InterceptedChannel.h
index 30da2551216a..695f5d5befa3 100644
--- a/netwerk/protocol/http/InterceptedChannel.h
+++ b/netwerk/protocol/http/InterceptedChannel.h
@@ -30,32 +30,22 @@ protected:
   // The interception controller to notify about the successful channel interception
   nsCOMPtr mController;
 
-  // The stream to write the body of the synthesized response
-  nsCOMPtr mResponseBody;
-
   // Response head for use when synthesizing
-  Maybe> mSynthesizedResponseHead;
-
-  // Whether this intercepted channel was performing a navigation.
-  bool mIsNavigation;
+  Maybe mSynthesizedResponseHead;
 
   void EnsureSynthesizedResponse();
-  void DoNotifyController();
+  void DoNotifyController(nsIOutputStream* aOut);
   nsresult DoSynthesizeHeader(const nsACString& aName, const nsACString& aValue);
 
   virtual ~InterceptedChannelBase();
 public:
-  InterceptedChannelBase(nsINetworkInterceptController* aController,
-                         bool aIsNavigation);
+  explicit InterceptedChannelBase(nsINetworkInterceptController* aController);
 
   // Notify the interception controller that the channel has been intercepted
   // and prepare the response body output stream.
   virtual void NotifyController() = 0;
 
   NS_DECL_ISUPPORTS
-
-  NS_IMETHOD GetResponseBody(nsIOutputStream** aOutput) MOZ_OVERRIDE;
-  NS_IMETHOD GetIsNavigation(bool* aIsNavigation) MOZ_OVERRIDE;
 };
 
 class InterceptedChannelChrome : public InterceptedChannelBase
@@ -70,11 +60,7 @@ public:
                            nsINetworkInterceptController* aController,
                            nsICacheEntry* aEntry);
 
-  NS_IMETHOD ResetInterception() MOZ_OVERRIDE;
-  NS_IMETHOD FinishSynthesizedResponse() MOZ_OVERRIDE;
-  NS_IMETHOD GetChannel(nsIChannel** aChannel) MOZ_OVERRIDE;
-  NS_IMETHOD SynthesizeHeader(const nsACString& aName, const nsACString& aValue) MOZ_OVERRIDE;
-  NS_IMETHOD Cancel() MOZ_OVERRIDE;
+  NS_DECL_NSIINTERCEPTEDCHANNEL
 
   virtual void NotifyController() MOZ_OVERRIDE;
 };
@@ -84,7 +70,8 @@ class InterceptedChannelContent : public InterceptedChannelBase
   // The actual channel being intercepted.
   nsRefPtr mChannel;
 
-  // Reader-side of the response body when synthesizing in a child proces
+  // Writeable buffer for use when synthesizing a response in a child process
+  nsCOMPtr mSynthesizedOutput;
   nsCOMPtr mSynthesizedInput;
 
   // Pump to read the synthesized body in child processes
@@ -98,11 +85,7 @@ public:
                             nsINetworkInterceptController* aController,
                             nsIStreamListener* aListener);
 
-  NS_IMETHOD ResetInterception() MOZ_OVERRIDE;
-  NS_IMETHOD FinishSynthesizedResponse() MOZ_OVERRIDE;
-  NS_IMETHOD GetChannel(nsIChannel** aChannel) MOZ_OVERRIDE;
-  NS_IMETHOD SynthesizeHeader(const nsACString& aName, const nsACString& aValue) MOZ_OVERRIDE;
-  NS_IMETHOD Cancel() MOZ_OVERRIDE;
+  NS_DECL_NSIINTERCEPTEDCHANNEL
 
   virtual void NotifyController() MOZ_OVERRIDE;
 };
diff --git a/netwerk/test/unit/test_synthesized_response.js b/netwerk/test/unit/test_synthesized_response.js
index 47b70f1b8061..00d489387aa8 100644
--- a/netwerk/test/unit/test_synthesized_response.js
+++ b/netwerk/test/unit/test_synthesized_response.js
@@ -55,19 +55,19 @@ function make_channel(url, body, cb) {
       this.numChecks++;
       return true;
     },
-    channelIntercepted: function(channel) {
+    channelIntercepted: function(channel, stream) {
       channel.QueryInterface(Ci.nsIInterceptedChannel);
       if (body) {
         var synthesized = Cc["@mozilla.org/io/string-input-stream;1"]
                             .createInstance(Ci.nsIStringInputStream);
         synthesized.data = body;
 
-        NetUtil.asyncCopy(synthesized, channel.responseBody, function() {
+        NetUtil.asyncCopy(synthesized, stream, function() {
           channel.finishSynthesizedResponse();
         });
       }
       if (cb) {
-        cb(channel);
+        cb(channel, stream);
       }
     },
   };
@@ -143,12 +143,12 @@ add_test(function() {
 
 // ensure that the channel waits for a decision and synthesizes headers correctly
 add_test(function() {
-  var chan = make_channel(URL + '/body', null, function(channel) {
+  var chan = make_channel(URL + '/body', null, function(channel, stream) {
     do_timeout(100, function() {
       var synthesized = Cc["@mozilla.org/io/string-input-stream;1"]
                           .createInstance(Ci.nsIStringInputStream);
       synthesized.data = NON_REMOTE_BODY;
-      NetUtil.asyncCopy(synthesized, channel.responseBody, function() {
+      NetUtil.asyncCopy(synthesized, stream, function() {
         channel.synthesizeHeader("Content-Length", NON_REMOTE_BODY.length);
         channel.finishSynthesizedResponse();
       });
@@ -169,12 +169,12 @@ add_test(function() {
 
 // ensure that the intercepted channel supports suspend/resume
 add_test(function() {
-  var chan = make_channel(URL + '/body', null, function(intercepted) {
+  var chan = make_channel(URL + '/body', null, function(intercepted, stream) {
     var synthesized = Cc["@mozilla.org/io/string-input-stream;1"]
                         .createInstance(Ci.nsIStringInputStream);
     synthesized.data = NON_REMOTE_BODY;
 
-    NetUtil.asyncCopy(synthesized, intercepted.responseBody, function() {
+    NetUtil.asyncCopy(synthesized, stream, function() {
       // set the content-type to ensure that the stream converter doesn't hold up notifications
       // and cause the test to fail
       intercepted.synthesizeHeader("Content-Type", "text/plain");
@@ -185,65 +185,6 @@ add_test(function() {
 				     CL_ALLOW_UNKNOWN_CL | CL_SUSPEND | CL_EXPECT_3S_DELAY), null);
 });
 
-// ensure that the intercepted channel can be cancelled
-add_test(function() {
-  var chan = make_channel(URL + '/body', null, function(intercepted) {
-    intercepted.cancel();
-  });
-  chan.asyncOpen(new ChannelListener(run_next_test, null,
-				     CL_EXPECT_FAILURE), null);
-});
-
-// ensure that the channel can't be cancelled via nsIInterceptedChannel after making a decision
-add_test(function() {
-  var chan = make_channel(URL + '/body', null, function(chan) {
-    chan.resetInterception();
-    do_timeout(0, function() {
-      var gotexception = false;
-      try {
-        chan.cancel();
-      } catch (x) {
-        gotexception = true;
-      }
-      do_check_true(gotexception);
-    });
-  });
-  chan.asyncOpen(new ChannelListener(handle_remote_response, null), null);
-});
-
-// ensure that the intercepted channel can be canceled during the response
-add_test(function() {
-  var chan = make_channel(URL + '/body', null, function(intercepted) {
-    var synthesized = Cc["@mozilla.org/io/string-input-stream;1"]
-                        .createInstance(Ci.nsIStringInputStream);
-    synthesized.data = NON_REMOTE_BODY;
-
-    NetUtil.asyncCopy(synthesized, intercepted.responseBody, function() {
-      let channel = intercepted.channel;
-      intercepted.finishSynthesizedResponse();
-      channel.cancel(Cr.NS_BINDING_ABORTED);
-    });
-  });
-  chan.asyncOpen(new ChannelListener(run_next_test, null,
-                                     CL_EXPECT_FAILURE | CL_ALLOW_UNKNOWN_CL), null);
-});
-
-// ensure that the intercepted channel can be canceled before the response
-add_test(function() {
-  var chan = make_channel(URL + '/body', null, function(intercepted) {
-    var synthesized = Cc["@mozilla.org/io/string-input-stream;1"]
-                        .createInstance(Ci.nsIStringInputStream);
-    synthesized.data = NON_REMOTE_BODY;
-
-    NetUtil.asyncCopy(synthesized, intercepted.responseBody, function() {
-      intercepted.channel.cancel(Cr.NS_BINDING_ABORTED);
-      intercepted.finishSynthesizedResponse();
-    });
-  });
-  chan.asyncOpen(new ChannelListener(run_next_test, null,
-                                     CL_EXPECT_FAILURE | CL_ALLOW_UNKNOWN_CL), null);
-});
-
 add_test(function() {
   httpServer.stop(run_next_test);
 });

From f225167cfe3d8a777a4bb5c6b2f221175a2ba3e9 Mon Sep 17 00:00:00 2001
From: Ryan VanderMeulen 
Date: Wed, 18 Feb 2015 16:00:46 -0500
Subject: [PATCH 087/115] Backed out changeset 25a4a1aecec4 (bug 1131749) for
 gtest failures. CLOSED TREE

---
 gfx/layers/apz/src/Axis.cpp | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/gfx/layers/apz/src/Axis.cpp b/gfx/layers/apz/src/Axis.cpp
index f87f78193224..5f05569b4008 100644
--- a/gfx/layers/apz/src/Axis.cpp
+++ b/gfx/layers/apz/src/Axis.cpp
@@ -263,23 +263,6 @@ void Axis::StepOverscrollAnimation(double aStepDurationMilliseconds) {
   // Adjust the amount of overscroll based on the velocity.
   // Note that we allow for oscillations.
   mOverscroll += (mVelocity * aStepDurationMilliseconds);
-
-  // Our mechanism for translating a set of mOverscroll values that oscillate
-  // around zero to a set of GetOverscroll() values that have the same sign
-  // (so content is always stretched, never compressed) assumes that
-  // mOverscroll does not exceed mFirstOverscrollAnimationSample in magnitude.
-  // If our calculations were exact, this would be the case, as
-  // mFirstOverscrollAnimationSample is the value of mOverscroll at the first
-  // peak of the oscillation, and a dampened spring should never attain a
-  // displacement greater in magnitude than a previous peak. In our
-  // approximation calculations, however, this may not hold exactly. To ensure
-  // the assumption is not violated, we clamp the magnitude of mOverscroll.
-  if (fabs(mOverscroll) > fabs(mFirstOverscrollAnimationSample)) {
-    mOverscroll = (mOverscroll >= 0)
-                ? fabs(mFirstOverscrollAnimationSample)
-                : -fabs(mFirstOverscrollAnimationSample);
-
-  }
 }
 
 bool Axis::SampleOverscrollAnimation(const TimeDuration& aDelta) {

From 302ff75d6301b77611fa186db87ff3d9b205f99d Mon Sep 17 00:00:00 2001
From: Nikhil Marathe 
Date: Tue, 17 Feb 2015 10:23:34 -0800
Subject: [PATCH 088/115] Bug 1126815 - Implement Response.finalURL.
 r=bkelly,baku

--HG--
extra : rebase_source : 5180d5657c60c7aec33e9f750d24cbee9a2890e2
---
 dom/bindings/Errors.msg                       |  1 +
 dom/fetch/FetchDriver.cpp                     |  8 +++++---
 dom/fetch/InternalResponse.cpp                |  2 ++
 dom/fetch/InternalResponse.h                  | 13 ++++++++++++
 dom/fetch/Response.cpp                        | 13 ++++++++++++
 dom/fetch/Response.h                          |  9 +++++++++
 dom/webidl/Response.webidl                    |  2 ++
 .../test/fetch/worker_test_response.js        | 20 +++++++++++++++++++
 8 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/dom/bindings/Errors.msg b/dom/bindings/Errors.msg
index c388123c4909..d3291a475a9a 100644
--- a/dom/bindings/Errors.msg
+++ b/dom/bindings/Errors.msg
@@ -71,3 +71,4 @@ MSG_DEF(MSG_INVALID_ZOOMANDPAN_VALUE_ERROR, 0, JSEXN_RANGEERR, "Invalid zoom and
 MSG_DEF(MSG_INVALID_TRANSFORM_ANGLE_ERROR, 0, JSEXN_RANGEERR, "Invalid transform angle.")
 MSG_DEF(MSG_INVALID_RESPONSE_STATUSCODE_ERROR, 0, JSEXN_RANGEERR, "Invalid response status code.")
 MSG_DEF(MSG_INVALID_REDIRECT_STATUSCODE_ERROR, 0, JSEXN_RANGEERR, "Invalid redirect status code.")
+MSG_DEF(MSG_RESPONSE_URL_IS_NULL, 0, JSEXN_TYPEERR, "Cannot set Response.finalURL when Response.url is null.")
diff --git a/dom/fetch/FetchDriver.cpp b/dom/fetch/FetchDriver.cpp
index 80f800307521..4e7f1422afe1 100644
--- a/dom/fetch/FetchDriver.cpp
+++ b/dom/fetch/FetchDriver.cpp
@@ -517,9 +517,11 @@ already_AddRefed
 FetchDriver::BeginAndGetFilteredResponse(InternalResponse* aResponse)
 {
   MOZ_ASSERT(aResponse);
-  nsAutoCString reqURL;
-  mRequest->GetURL(reqURL);
-  aResponse->SetUrl(reqURL);
+  if (!aResponse->FinalURL()) {
+    nsAutoCString reqURL;
+    mRequest->GetURL(reqURL);
+    aResponse->SetUrl(reqURL);
+  }
 
   // FIXME(nsm): Handle mixed content check, step 7 of fetch.
 
diff --git a/dom/fetch/InternalResponse.cpp b/dom/fetch/InternalResponse.cpp
index c69f0057a59a..651a6dc29098 100644
--- a/dom/fetch/InternalResponse.cpp
+++ b/dom/fetch/InternalResponse.cpp
@@ -14,6 +14,7 @@ namespace dom {
 
 InternalResponse::InternalResponse(uint16_t aStatus, const nsACString& aStatusText)
   : mType(ResponseType::Default)
+  , mFinalURL(false)
   , mStatus(aStatus)
   , mStatusText(aStatusText)
   , mHeaders(new InternalHeaders(HeadersGuardEnum::Response))
@@ -26,6 +27,7 @@ InternalResponse::InternalResponse(const InternalResponse& aOther)
   : mType(aOther.mType)
   , mTerminationReason(aOther.mTerminationReason)
   , mURL(aOther.mURL)
+  , mFinalURL(aOther.mFinalURL)
   , mStatus(aOther.mStatus)
   , mStatusText(aOther.mStatusText)
   , mBody(aOther.mBody)
diff --git a/dom/fetch/InternalResponse.h b/dom/fetch/InternalResponse.h
index b3ca6e06f7c3..9151a72edc8a 100644
--- a/dom/fetch/InternalResponse.h
+++ b/dom/fetch/InternalResponse.h
@@ -76,6 +76,18 @@ public:
     mURL.Assign(aURL);
   }
 
+  bool
+  FinalURL() const
+  {
+    return mFinalURL;
+  }
+
+  void
+  SetFinalURL(bool aFinalURL)
+  {
+    mFinalURL = aFinalURL;
+  }
+
   uint16_t
   GetStatus() const
   {
@@ -120,6 +132,7 @@ private:
   ResponseType mType;
   nsCString mTerminationReason;
   nsCString mURL;
+  bool mFinalURL;
   const uint16_t mStatus;
   const nsCString mStatusText;
   nsRefPtr mHeaders;
diff --git a/dom/fetch/Response.cpp b/dom/fetch/Response.cpp
index 5be922d72a27..711bb6e20a83 100644
--- a/dom/fetch/Response.cpp
+++ b/dom/fetch/Response.cpp
@@ -215,5 +215,18 @@ Response::Headers_()
 
   return mHeaders;
 }
+
+void
+Response::SetFinalURL(bool aFinalURL, ErrorResult& aRv)
+{
+  nsCString url;
+  mInternalResponse->GetUrl(url);
+  if (url.IsEmpty()) {
+    aRv.ThrowTypeError(MSG_RESPONSE_URL_IS_NULL);
+    return;
+  }
+
+  mInternalResponse->SetFinalURL(aFinalURL);
+}
 } // namespace dom
 } // namespace mozilla
diff --git a/dom/fetch/Response.h b/dom/fetch/Response.h
index 49bcbfc6b55a..28cf540c2792 100644
--- a/dom/fetch/Response.h
+++ b/dom/fetch/Response.h
@@ -56,6 +56,15 @@ public:
     aUrl.AsAString() = NS_ConvertUTF8toUTF16(url);
   }
 
+  bool
+  GetFinalURL(ErrorResult& aRv) const
+  {
+    return mInternalResponse->FinalURL();
+  }
+
+  void
+  SetFinalURL(bool aFinalURL, ErrorResult& aRv);
+
   uint16_t
   Status() const
   {
diff --git a/dom/webidl/Response.webidl b/dom/webidl/Response.webidl
index 69ae851a35ca..f7d377244ae5 100644
--- a/dom/webidl/Response.webidl
+++ b/dom/webidl/Response.webidl
@@ -18,6 +18,8 @@ interface Response {
   readonly attribute ResponseType type;
 
   readonly attribute USVString url;
+  [Throws]
+           attribute boolean finalURL;
   readonly attribute unsigned short status;
   readonly attribute boolean ok;
   readonly attribute ByteString statusText;
diff --git a/dom/workers/test/fetch/worker_test_response.js b/dom/workers/test/fetch/worker_test_response.js
index 735797000ed0..5f2e11f4c4ae 100644
--- a/dom/workers/test/fetch/worker_test_response.js
+++ b/dom/workers/test/fetch/worker_test_response.js
@@ -66,6 +66,25 @@ function testOk() {
   ok(!r4.ok, "Response with status 302 should have ok false");
 }
 
+// It is not possible to test setting finalURL until we have ServiceWorker
+// interception. This is because synthetic Responses do not have a url, the url
+// is set based on the request, so a SW could initiate a fetch() on behalf of
+// a client and set the resulting Response's finalURL before returning it to
+// the client, in which case the "set response's url to request's url" from the
+// client's point of view would not happen. A test for this will be added by
+// Bug 1134352.
+function testFinalURL() {
+  var r1 = new Response();
+  ok(!r1.finalURL, "Response.finalURL is false by default.");
+
+  try {
+    r1.finalURL = true;
+    ok(false, "Setting Response.finalURL of Response with null url should fail.");
+  } catch(e) {
+    ok(true, "Setting Response.finalURL of Response with null url should fail.");
+  }
+}
+
 function testBodyUsed() {
   var res = new Response("Sample body");
   ok(!res.bodyUsed, "bodyUsed is initially false.");
@@ -153,6 +172,7 @@ onmessage = function() {
   testClone();
   testRedirect();
   testOk();
+  testFinalURL();
 
   Promise.resolve()
     .then(testBodyCreation)

From 66705f877420abb78d88ffb70948f4c84945c8c2 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Tue, 17 Feb 2015 18:39:34 -0800
Subject: [PATCH 089/115] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump

========

https://hg.mozilla.org/integration/gaia-central/rev/b811569e2c24
Author: autolander 
Desc: Bug 1130547 - merge pull request #28276 from jrburke:bug1130547-email-test-notification to mozilla-b2g:master

========

https://hg.mozilla.org/integration/gaia-central/rev/1e3e03416768
Author: jrburke 
Desc: Bug 1130547 - [email] marionettejs tests that use notification iconURL fail
---
 b2g/config/gaia.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index edcb43d7cc16..0115bca9fdf8 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
-        "git_revision": "82f286f10a41aab84a0796c89fbefe67b179994b", 
+        "git_revision": "a966e77a7cb8c703a8fb6f6d8ad659aca5b6512c", 
         "remote": "https://git.mozilla.org/releases/gaia.git", 
         "branch": ""
     }, 
-    "revision": "066f0e84321a010700467d1814ee0048dca7e5e1", 
+    "revision": "b811569e2c24e034183ec0811f9f684167ee3be4", 
     "repo_path": "integration/gaia-central"
 }

From 9a5f780aadf0192742e03f21ab1c8598a283f084 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Tue, 17 Feb 2015 18:42:31 -0800
Subject: [PATCH 090/115] Bumping manifests a=b2g-bump

---
 b2g/config/dolphin/sources.xml      | 2 +-
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 2 +-
 b2g/config/emulator-kk/sources.xml  | 2 +-
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/flame-kk/sources.xml     | 2 +-
 b2g/config/flame/sources.xml        | 2 +-
 b2g/config/nexus-4/sources.xml      | 2 +-
 b2g/config/nexus-5-l/sources.xml    | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index 42bd9c154481..23c9f9b6a9be 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index 9ff11e7dea42..cf00f62f312d 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index a3df89379722..261363b51819 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index 1a9f1ba62411..daaaa35869a6 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index 9ff11e7dea42..cf00f62f312d 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index 54e04b171661..730476330f38 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml
index c49eebaf5299..7447c76613f6 100644
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index 945311cc7168..14e7bff00f7a 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml
index 9c298260e4ae..9c3f46eb748c 100644
--- a/b2g/config/nexus-5-l/sources.xml
+++ b/b2g/config/nexus-5-l/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   

From 86a74e900cec8209c0a00a724523cb586c6bed2d Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Tue, 17 Feb 2015 23:19:07 -0800
Subject: [PATCH 091/115] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump

========

https://hg.mozilla.org/integration/gaia-central/rev/a4970a36cbde
Author: autolander 
Desc: Bug 1130883 - merge pull request #28246 from KevinGrandon:bug_1130883_history_heading_without_test to mozilla-b2g:master

========

https://hg.mozilla.org/integration/gaia-central/rev/d271d7708836
Author: Kevin Grandon 
Desc: Bug 1130883 - Hide history heading when no results displayed r=daleharvey

========

https://hg.mozilla.org/integration/gaia-central/rev/80882c383123
Author: autolander 
Desc: Bug 1132996 - merge pull request #28272 from yzen:bug-1132996 to mozilla-b2g:master

========

https://hg.mozilla.org/integration/gaia-central/rev/309411724630
Author: Yura Zenevich 
Desc: Bug 1132996 - fixing the markup order based on presentation order.
---
 b2g/config/gaia.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 0115bca9fdf8..622f9a7c875c 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
-        "git_revision": "a966e77a7cb8c703a8fb6f6d8ad659aca5b6512c", 
+        "git_revision": "1455349736277a498fa2fde57fbaddca63aab3b2", 
         "remote": "https://git.mozilla.org/releases/gaia.git", 
         "branch": ""
     }, 
-    "revision": "b811569e2c24e034183ec0811f9f684167ee3be4", 
+    "revision": "a4970a36cbdeb7792fd3a18781a2ba7234cf066f", 
     "repo_path": "integration/gaia-central"
 }

From 754e0aa19ec59fedff94f1a4a05648353cb83baa Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Tue, 17 Feb 2015 23:21:31 -0800
Subject: [PATCH 092/115] Bumping manifests a=b2g-bump

---
 b2g/config/dolphin/sources.xml      | 2 +-
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 2 +-
 b2g/config/emulator-kk/sources.xml  | 2 +-
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/flame-kk/sources.xml     | 2 +-
 b2g/config/flame/sources.xml        | 2 +-
 b2g/config/nexus-4/sources.xml      | 2 +-
 b2g/config/nexus-5-l/sources.xml    | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index 23c9f9b6a9be..e8722e232619 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index cf00f62f312d..5c3bb4c2bd4c 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index 261363b51819..84cbe6c4e43c 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index daaaa35869a6..19eb759bc6b0 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index cf00f62f312d..5c3bb4c2bd4c 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index 730476330f38..9024903497e1 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml
index 7447c76613f6..a228226a7a17 100644
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index 14e7bff00f7a..21ffac01506e 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml
index 9c3f46eb748c..fb3c3266ceaf 100644
--- a/b2g/config/nexus-5-l/sources.xml
+++ b/b2g/config/nexus-5-l/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   

From 66869eb22fdd10a388b2681e296f0b2b4d9ea106 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 00:05:18 -0800
Subject: [PATCH 093/115] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump

========

https://hg.mozilla.org/integration/gaia-central/rev/bf22338428e3
Author: autolander 
Desc: Bug 1131492 - merge pull request #28151 from autra:bug-1131492 to mozilla-b2g:master

========

https://hg.mozilla.org/integration/gaia-central/rev/42675054623a
Author: Augustin Trancart 
Desc: Bug 1131492 - Keep toolbar LTR for callscreen even if language is RTL
---
 b2g/config/gaia.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 622f9a7c875c..3982e48001e7 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
-        "git_revision": "1455349736277a498fa2fde57fbaddca63aab3b2", 
+        "git_revision": "86f6acffbd2aeb5899b7592d133fc8713f2a223e", 
         "remote": "https://git.mozilla.org/releases/gaia.git", 
         "branch": ""
     }, 
-    "revision": "a4970a36cbdeb7792fd3a18781a2ba7234cf066f", 
+    "revision": "bf22338428e345bf6755f17f021db987b2992224", 
     "repo_path": "integration/gaia-central"
 }

From 9186f97656b86f9f88f97965dc20f5d8fa35e659 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 00:07:43 -0800
Subject: [PATCH 094/115] Bumping manifests a=b2g-bump

---
 b2g/config/dolphin/sources.xml      | 2 +-
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 2 +-
 b2g/config/emulator-kk/sources.xml  | 2 +-
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/flame-kk/sources.xml     | 2 +-
 b2g/config/flame/sources.xml        | 2 +-
 b2g/config/nexus-4/sources.xml      | 2 +-
 b2g/config/nexus-5-l/sources.xml    | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index e8722e232619..f339ed6d1ffb 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index 5c3bb4c2bd4c..d5b3610322cb 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index 84cbe6c4e43c..dfb708e2561e 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index 19eb759bc6b0..d01c728ee92a 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index 5c3bb4c2bd4c..d5b3610322cb 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index 9024903497e1..e708d7ea1e01 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml
index a228226a7a17..a2ed2435f307 100644
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index 21ffac01506e..26b75ba7abb3 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml
index fb3c3266ceaf..b1204ff292e6 100644
--- a/b2g/config/nexus-5-l/sources.xml
+++ b/b2g/config/nexus-5-l/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   

From 791f4606ace66d70e1d950e7cbc1b67469516eda Mon Sep 17 00:00:00 2001
From: Wander Lairson Costa 
Date: Wed, 18 Feb 2015 08:10:13 -0200
Subject: [PATCH 095/115] Bug 1109365: Default try graph platforms to all.

When the platfoms list is not supplied by cli,
default to all platforms.
---
 testing/taskcluster/taskcluster_graph/commit_parser.py | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/testing/taskcluster/taskcluster_graph/commit_parser.py b/testing/taskcluster/taskcluster_graph/commit_parser.py
index 12b4adf7322d..bc3005c2f173 100644
--- a/testing/taskcluster/taskcluster_graph/commit_parser.py
+++ b/testing/taskcluster/taskcluster_graph/commit_parser.py
@@ -175,14 +175,10 @@ def parse_commit(message, jobs):
     # Argument parser based on try flag flags
     parser = argparse.ArgumentParser()
     parser.add_argument('-b', dest='build_types')
-    parser.add_argument('-p', dest='platforms')
-    parser.add_argument('-u', dest='tests')
+    parser.add_argument('-p', nargs='?', dest='platforms', const='all', default='all')
+    parser.add_argument('-u', nargs='?', dest='tests', const='all', default='all')
     args, unknown = parser.parse_known_args(parts[1:])
 
-    # Sanity check platforms...
-    if args.platforms is None:
-        return []
-
     # Then builds...
     if args.build_types is None:
         return []

From ac68d65473058f490a6047b88bdd071f582c458a Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 03:44:10 -0800
Subject: [PATCH 096/115] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump

========

https://hg.mozilla.org/integration/gaia-central/rev/b10838834b4a
Author: autolander 
Desc: Bug 1132545 - merge pull request #28271 from autra:bug-1132545 to mozilla-b2g:master

========

https://hg.mozilla.org/integration/gaia-central/rev/a39896c18807
Author: Augustin Trancart 
Desc: Bug 1132545 - display title left to right for videos, even if language is RTL
---
 b2g/config/gaia.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 3982e48001e7..59598d06d5a0 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
-        "git_revision": "86f6acffbd2aeb5899b7592d133fc8713f2a223e", 
+        "git_revision": "9539c8406afa7d0ce4d4e876d093b59b84bff994", 
         "remote": "https://git.mozilla.org/releases/gaia.git", 
         "branch": ""
     }, 
-    "revision": "bf22338428e345bf6755f17f021db987b2992224", 
+    "revision": "b10838834b4ad639708e8b038f18df5912f1ecce", 
     "repo_path": "integration/gaia-central"
 }

From ab00c65e0a9ba15d7cc0ad3ee3fb4f1cbb4d8544 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 03:46:34 -0800
Subject: [PATCH 097/115] Bumping manifests a=b2g-bump

---
 b2g/config/dolphin/sources.xml      | 2 +-
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 2 +-
 b2g/config/emulator-kk/sources.xml  | 2 +-
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/flame-kk/sources.xml     | 2 +-
 b2g/config/flame/sources.xml        | 2 +-
 b2g/config/nexus-4/sources.xml      | 2 +-
 b2g/config/nexus-5-l/sources.xml    | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index f339ed6d1ffb..f2249c9d9684 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index d5b3610322cb..e03d14ce0289 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index dfb708e2561e..afc7702fa3ee 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index d01c728ee92a..3c4c40b59411 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index d5b3610322cb..e03d14ce0289 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index e708d7ea1e01..173820e78c85 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml
index a2ed2435f307..788d907b55cb 100644
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index 26b75ba7abb3..e4cc4fda3651 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml
index b1204ff292e6..e97e8f4bbc45 100644
--- a/b2g/config/nexus-5-l/sources.xml
+++ b/b2g/config/nexus-5-l/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   

From 46dde1caaf29ad0943e2e8ff233cd886106cfcc0 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 04:05:07 -0800
Subject: [PATCH 098/115] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump

========

https://hg.mozilla.org/integration/gaia-central/rev/6ef17af44ac3
Author: Kevin Grandon 
Desc: Merge pull request #28283 from KevinGrandon/bug_1133971_temp_fix_for_offset_inline_block

Bug 1133971 - Add temporary workaround for offset-inline offset-block support

========

https://hg.mozilla.org/integration/gaia-central/rev/ca0ce5e390c4
Author: Kevin Grandon 
Desc: Bug 1133971 - Add temporary workaround for offset-inline offset-block support r=rickychien
---
 b2g/config/gaia.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 59598d06d5a0..229ccb375d4b 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
-        "git_revision": "9539c8406afa7d0ce4d4e876d093b59b84bff994", 
+        "git_revision": "696a316c24416a83bacd3b49c1be65e0124c3dd9", 
         "remote": "https://git.mozilla.org/releases/gaia.git", 
         "branch": ""
     }, 
-    "revision": "b10838834b4ad639708e8b038f18df5912f1ecce", 
+    "revision": "6ef17af44ac39ad08278b570f7b283a424edf95b", 
     "repo_path": "integration/gaia-central"
 }

From 4f062513a3b62082ac028103c3b8486ad4c8992d Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 04:07:31 -0800
Subject: [PATCH 099/115] Bumping manifests a=b2g-bump

---
 b2g/config/dolphin/sources.xml      | 2 +-
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 2 +-
 b2g/config/emulator-kk/sources.xml  | 2 +-
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/flame-kk/sources.xml     | 2 +-
 b2g/config/flame/sources.xml        | 2 +-
 b2g/config/nexus-4/sources.xml      | 2 +-
 b2g/config/nexus-5-l/sources.xml    | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index f2249c9d9684..a916a924934c 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index e03d14ce0289..3b8717931d39 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index afc7702fa3ee..e879e796fccd 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index 3c4c40b59411..e568ac8f333b 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index e03d14ce0289..3b8717931d39 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index 173820e78c85..078c1523186b 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml
index 788d907b55cb..7f25fbf11cff 100644
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index e4cc4fda3651..68f6db39c27d 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml
index e97e8f4bbc45..ab63c52eee2c 100644
--- a/b2g/config/nexus-5-l/sources.xml
+++ b/b2g/config/nexus-5-l/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   

From 2fd7111639d56701da51facb82c3f76495d45144 Mon Sep 17 00:00:00 2001
From: Wander Lairson Costa 
Date: Wed, 18 Feb 2015 11:41:31 -0200
Subject: [PATCH 100/115] Bug 1132583: Use different object folders for opt and
 debug builds.

Due to caching, using the same object folder for debug and opt builds
may lead to object linking issues.
---
 testing/taskcluster/tasks/builds/b2g_desktop_base.yml  | 2 --
 testing/taskcluster/tasks/builds/b2g_desktop_debug.yml | 7 +++++++
 testing/taskcluster/tasks/builds/b2g_desktop_opt.yml   | 7 +++++++
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/testing/taskcluster/tasks/builds/b2g_desktop_base.yml b/testing/taskcluster/tasks/builds/b2g_desktop_base.yml
index d0c47fee6b88..984b140dc003 100644
--- a/testing/taskcluster/tasks/builds/b2g_desktop_base.yml
+++ b/testing/taskcluster/tasks/builds/b2g_desktop_base.yml
@@ -9,13 +9,11 @@ task:
   scopes:
     - 'docker-worker:cache:sources-gecko'
     - 'docker-worker:cache:sources-gaia'
-    - 'docker-worker:cache:build-b2g-desktop-objects'
 
   payload:
     cache:
       sources-gaia: '/home/worker/gaia'
       sources-gecko: '/home/worker/gecko'
-      build-b2g-desktop-objects: '/home/worker/object-folder'
 
     env:
       MOZCONFIG: 'b2g/config/mozconfigs/linux64_gecko/nightly'
diff --git a/testing/taskcluster/tasks/builds/b2g_desktop_debug.yml b/testing/taskcluster/tasks/builds/b2g_desktop_debug.yml
index 4084235ec919..07b446d958b6 100644
--- a/testing/taskcluster/tasks/builds/b2g_desktop_debug.yml
+++ b/testing/taskcluster/tasks/builds/b2g_desktop_debug.yml
@@ -4,6 +4,13 @@ $inherits:
     build_type: 'debug'
 
 task:
+  scopes:
+      - 'docker-worker:cache:build-b2g-desktop-objects-debug'
+
+  payload:
+    cache:
+        build-b2g-desktop-objects-debug: '/home/worker/object-folder'
+
   extra:
     treeherder:
       collection:
diff --git a/testing/taskcluster/tasks/builds/b2g_desktop_opt.yml b/testing/taskcluster/tasks/builds/b2g_desktop_opt.yml
index 9075a78a710c..4b9f8abac7a5 100644
--- a/testing/taskcluster/tasks/builds/b2g_desktop_opt.yml
+++ b/testing/taskcluster/tasks/builds/b2g_desktop_opt.yml
@@ -4,6 +4,13 @@ $inherits:
     build_type: 'opt'
 
 task:
+  scopes:
+      - 'docker-worker:cache:build-b2g-desktop-objects-opt'
+
+  payload:
+    cache:
+        build-b2g-desktop-objects-opt: '/home/worker/object-folder'
+
   payload:
     env:
       MOZCONFIG: 'b2g/config/mozconfigs/linux64_gecko/nightly'

From d39207ac388f6b698a88131f751a6cc01a733445 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 07:05:29 -0800
Subject: [PATCH 101/115] Bumping gaia.json for 3 gaia revision(s) a=gaia-bump

========

https://hg.mozilla.org/integration/gaia-central/rev/cf06a9412d5a
Author: Kevin Grandon 
Desc: Merge pull request #28264 from KevinGrandon/bug_1133724_fmd_dev_apps

Bug 1133724 - Migrate test-findmydevice to a fixture folder

========

https://hg.mozilla.org/integration/gaia-central/rev/9ed3dedc9b9c
Author: Kevin Grandon 
Desc: Bug 1133724 - Migrate test-findmydevice to a fixture folder r=gerard-majax

========

https://hg.mozilla.org/integration/gaia-central/rev/42f5bb2d26a1
Author: Kevin Grandon 
Desc: Bug 1134144 - Fix openContextMenu to handle a different amount of icons on the vertical home screen r=kgrandon
---
 b2g/config/gaia.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 229ccb375d4b..635ad5eae09a 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
-        "git_revision": "696a316c24416a83bacd3b49c1be65e0124c3dd9", 
+        "git_revision": "6875a6ac9bcfacc5a7d97fc7a6839105dfeeb9e2", 
         "remote": "https://git.mozilla.org/releases/gaia.git", 
         "branch": ""
     }, 
-    "revision": "6ef17af44ac39ad08278b570f7b283a424edf95b", 
+    "revision": "cf06a9412d5a3fbc9d9a8bed418d26c2223e2eb9", 
     "repo_path": "integration/gaia-central"
 }

From 3ff869633a7df197881d0d35171269dd2c78a807 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 07:07:56 -0800
Subject: [PATCH 102/115] Bumping manifests a=b2g-bump

---
 b2g/config/dolphin/sources.xml      | 4 ++--
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 4 ++--
 b2g/config/emulator-kk/sources.xml  | 4 ++--
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/flame-kk/sources.xml     | 4 ++--
 b2g/config/flame/sources.xml        | 2 +-
 b2g/config/nexus-4/sources.xml      | 4 ++--
 b2g/config/nexus-5-l/sources.xml    | 4 ++--
 9 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index a916a924934c..695d5d34fe9a 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
@@ -118,7 +118,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index 3b8717931d39..ebc95d3baf8f 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index e879e796fccd..844f1538f36e 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
@@ -120,7 +120,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index e568ac8f333b..4a9930f2fde6 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
@@ -118,7 +118,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index 3b8717931d39..ebc95d3baf8f 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index 078c1523186b..806e2aaa8daa 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
@@ -111,7 +111,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml
index 7f25fbf11cff..8ae95c6cc17e 100644
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index 68f6db39c27d..8210c40fae94 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
@@ -120,7 +120,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml
index ab63c52eee2c..eef05e44ed38 100644
--- a/b2g/config/nexus-5-l/sources.xml
+++ b/b2g/config/nexus-5-l/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
@@ -128,7 +128,7 @@
   
   
   
-  
+  
   
   
   

From 79f98d02247b878b9625bec0f836c6d35dbefeae Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 07:44:23 -0800
Subject: [PATCH 103/115] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump

========

https://hg.mozilla.org/integration/gaia-central/rev/fd0a6174128f
Author: autolander 
Desc: Bug 1129701 - merge pull request #28256 from anefzaoui:bug-1129701 to mozilla-b2g:master

========

https://hg.mozilla.org/integration/gaia-central/rev/bc24f6b48904
Author: Ahmed Nefzaoui 
Desc: Bug 1129701 - [RTL][Rocket Bar] Settings icon is not on the right side of 'No internet connection'

========

https://hg.mozilla.org/integration/gaia-central/rev/c18a776a6760
Author: autolander 
Desc: Bug 1064148 - merge pull request #27430 from anefzaoui:bug-1064148-1 to mozilla-b2g:master

========

https://hg.mozilla.org/integration/gaia-central/rev/dcc7df4e0fb0
Author: Ahmed Nefzaoui 
Desc: Bug 1064148 - [RTL] Notifications Open button misplaced
---
 b2g/config/gaia.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 635ad5eae09a..11279653370d 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
-        "git_revision": "6875a6ac9bcfacc5a7d97fc7a6839105dfeeb9e2", 
+        "git_revision": "db44e23e519094bf3db9b733f8f632689fdb20d1", 
         "remote": "https://git.mozilla.org/releases/gaia.git", 
         "branch": ""
     }, 
-    "revision": "cf06a9412d5a3fbc9d9a8bed418d26c2223e2eb9", 
+    "revision": "fd0a6174128f9f89a7fc11243690a2881d558b83", 
     "repo_path": "integration/gaia-central"
 }

From d621546039a00eec5053bf94908c7df5b932f06b Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 07:47:08 -0800
Subject: [PATCH 104/115] Bumping manifests a=b2g-bump

---
 b2g/config/dolphin/sources.xml      | 2 +-
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 2 +-
 b2g/config/emulator-kk/sources.xml  | 2 +-
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/flame-kk/sources.xml     | 2 +-
 b2g/config/flame/sources.xml        | 2 +-
 b2g/config/nexus-4/sources.xml      | 2 +-
 b2g/config/nexus-5-l/sources.xml    | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index 695d5d34fe9a..bc7ec2a4dd0c 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index ebc95d3baf8f..aff055d34a83 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index 844f1538f36e..4c4fd6039db9 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index 4a9930f2fde6..8993eb93dd40 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index ebc95d3baf8f..aff055d34a83 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index 806e2aaa8daa..8807a05d2881 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml
index 8ae95c6cc17e..e1e4dfd6e166 100644
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index 8210c40fae94..e6b6c3c09853 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml
index eef05e44ed38..018993b18758 100644
--- a/b2g/config/nexus-5-l/sources.xml
+++ b/b2g/config/nexus-5-l/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   

From ec6acb3b04f604e4f2bfb8fc2d346245dffa379c Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 08:45:08 -0800
Subject: [PATCH 105/115] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump

========

https://hg.mozilla.org/integration/gaia-central/rev/fbf9ae2e954d
Author: autolander 
Desc: Bug 1125095 - merge pull request #28079 from sfoster:task-manager-polish-bug-1125095 to mozilla-b2g:master

========

https://hg.mozilla.org/integration/gaia-central/rev/06deeec8b835
Author: Sam Foster 
Desc: Bug 1125095 - Task manager/tab view button tray polish
---
 b2g/config/gaia.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 11279653370d..10569516e0be 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
-        "git_revision": "db44e23e519094bf3db9b733f8f632689fdb20d1", 
+        "git_revision": "a0bfc4ca03b5b11aaf1e58e9161fe54a1805e475", 
         "remote": "https://git.mozilla.org/releases/gaia.git", 
         "branch": ""
     }, 
-    "revision": "fd0a6174128f9f89a7fc11243690a2881d558b83", 
+    "revision": "fbf9ae2e954d62d18641ec1ded5fe8678f9e68e6", 
     "repo_path": "integration/gaia-central"
 }

From e42b5bcbc1342ae55f0f4e7b1ea035a37f6262b6 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 08:47:32 -0800
Subject: [PATCH 106/115] Bumping manifests a=b2g-bump

---
 b2g/config/dolphin/sources.xml      | 2 +-
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 2 +-
 b2g/config/emulator-kk/sources.xml  | 2 +-
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/flame-kk/sources.xml     | 2 +-
 b2g/config/flame/sources.xml        | 2 +-
 b2g/config/nexus-4/sources.xml      | 2 +-
 b2g/config/nexus-5-l/sources.xml    | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index bc7ec2a4dd0c..05ca4e242a13 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index aff055d34a83..5cc55ca8f045 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index 4c4fd6039db9..1f94a1c10ad3 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index 8993eb93dd40..5bab03cd4c45 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index aff055d34a83..5cc55ca8f045 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index 8807a05d2881..78bd5d33a5fe 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml
index e1e4dfd6e166..26d8ff316cba 100644
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index e6b6c3c09853..32a255a05643 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml
index 018993b18758..5cfd4f814e09 100644
--- a/b2g/config/nexus-5-l/sources.xml
+++ b/b2g/config/nexus-5-l/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   

From b1936dee7370cb7a995fbe8e03c5da725b2585b6 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 10:04:20 -0800
Subject: [PATCH 107/115] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump

========

https://hg.mozilla.org/integration/gaia-central/rev/0f8eccb546d6
Author: autolander 
Desc: Bug 1134178 - merge pull request #28284 from julienw:1134178-fix-bad-english to mozilla-b2g:master

========

https://hg.mozilla.org/integration/gaia-central/rev/b899e83f67c6
Author: Julien Wajsberg 
Desc: Bug 1134178 - [Messages] Fix bad english r=azasypkin
---
 b2g/config/gaia.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 10569516e0be..e0260171c928 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
-        "git_revision": "a0bfc4ca03b5b11aaf1e58e9161fe54a1805e475", 
+        "git_revision": "3cc2e71a5038f4e69a7304ee2daec5790a3c25c3", 
         "remote": "https://git.mozilla.org/releases/gaia.git", 
         "branch": ""
     }, 
-    "revision": "fbf9ae2e954d62d18641ec1ded5fe8678f9e68e6", 
+    "revision": "0f8eccb546d6b2d2afb431e670fdb4db6ffddafb", 
     "repo_path": "integration/gaia-central"
 }

From 08627731e9d8b66646e98772098b870b7d4691c8 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 10:06:59 -0800
Subject: [PATCH 108/115] Bumping manifests a=b2g-bump

---
 b2g/config/dolphin/sources.xml      | 2 +-
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 2 +-
 b2g/config/emulator-kk/sources.xml  | 2 +-
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/flame-kk/sources.xml     | 2 +-
 b2g/config/flame/sources.xml        | 2 +-
 b2g/config/nexus-4/sources.xml      | 2 +-
 b2g/config/nexus-5-l/sources.xml    | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index 05ca4e242a13..781f67885a4d 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index 5cc55ca8f045..e83505d35dc9 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index 1f94a1c10ad3..9bffe7c09896 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index 5bab03cd4c45..ce000384ac64 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index 5cc55ca8f045..e83505d35dc9 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index 78bd5d33a5fe..48589a9a30d2 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml
index 26d8ff316cba..6aa95ffd095f 100644
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index 32a255a05643..d77fec027e8c 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml
index 5cfd4f814e09..c48f3659c68f 100644
--- a/b2g/config/nexus-5-l/sources.xml
+++ b/b2g/config/nexus-5-l/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   

From 9f27947be5ea1b4cf6ead3b523cf6d48fed1e75f Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 11:46:24 -0800
Subject: [PATCH 109/115] Bumping manifests a=b2g-bump

---
 b2g/config/dolphin/sources.xml     | 2 +-
 b2g/config/emulator-jb/sources.xml | 2 +-
 b2g/config/emulator-kk/sources.xml | 2 +-
 b2g/config/flame-kk/sources.xml    | 2 +-
 b2g/config/nexus-4/sources.xml     | 2 +-
 b2g/config/nexus-5-l/sources.xml   | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index 781f67885a4d..dd94159efd5e 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -118,7 +118,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index 9bffe7c09896..69f55b21de5b 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -120,7 +120,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index ce000384ac64..95b636adde78 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -118,7 +118,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index 48589a9a30d2..1e46ba301e8d 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -111,7 +111,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index d77fec027e8c..99720e7d993a 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -120,7 +120,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml
index c48f3659c68f..e718c6f48247 100644
--- a/b2g/config/nexus-5-l/sources.xml
+++ b/b2g/config/nexus-5-l/sources.xml
@@ -128,7 +128,7 @@
   
   
   
-  
+  
   
   
   

From e211e7e32541e2bfb5d8801a63e395287a1edd0d Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 12:24:54 -0800
Subject: [PATCH 110/115] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump

========

https://hg.mozilla.org/integration/gaia-central/rev/6c1ba29d642f
Author: autolander 
Desc: Bug 1130975 - merge pull request #28184 from mcav:clock-tabs-rtl to mozilla-b2g:master

========

https://hg.mozilla.org/integration/gaia-central/rev/223a5d231bfe
Author: Marcus Cavanaugh 
Desc: Bug 1130975 - [Clock] Tabs are shown in English before l10n loads.
---
 b2g/config/gaia.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index e0260171c928..c283d7985c0b 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
-        "git_revision": "3cc2e71a5038f4e69a7304ee2daec5790a3c25c3", 
+        "git_revision": "cb452d55651beb33ae19a513824ad79d61799495", 
         "remote": "https://git.mozilla.org/releases/gaia.git", 
         "branch": ""
     }, 
-    "revision": "0f8eccb546d6b2d2afb431e670fdb4db6ffddafb", 
+    "revision": "6c1ba29d642ff2c115c2903ad08c5ba0638efbb8", 
     "repo_path": "integration/gaia-central"
 }

From 9107b7442605f12c5dc0161f2bb874b99bb2a470 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 12:27:21 -0800
Subject: [PATCH 111/115] Bumping manifests a=b2g-bump

---
 b2g/config/dolphin/sources.xml      | 2 +-
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 2 +-
 b2g/config/emulator-kk/sources.xml  | 2 +-
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/flame-kk/sources.xml     | 2 +-
 b2g/config/flame/sources.xml        | 2 +-
 b2g/config/nexus-4/sources.xml      | 2 +-
 b2g/config/nexus-5-l/sources.xml    | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index dd94159efd5e..db67f7206769 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index e83505d35dc9..ab60b8f04f2e 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index 69f55b21de5b..921b83df918f 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index 95b636adde78..445d9990719c 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index e83505d35dc9..ab60b8f04f2e 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index 1e46ba301e8d..aa04a810b8c1 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml
index 6aa95ffd095f..cb4f05c32922 100644
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index 99720e7d993a..39b2f35d881c 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml
index e718c6f48247..089d236671ee 100644
--- a/b2g/config/nexus-5-l/sources.xml
+++ b/b2g/config/nexus-5-l/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   

From 1e56c4663eade1c7e4af9dee9dbfb3b4a3b24d71 Mon Sep 17 00:00:00 2001
From: Xidorn Quan 
Date: Thu, 19 Feb 2015 10:29:35 +1300
Subject: [PATCH 112/115] Bug 1133384 - Add -MaxILKSize to LDFLAGS for MSVC to
 avoid LNK1248 error. r=glandium

--HG--
extra : source : 6a79ec902a458bf52ea6d25d5eb3f5dc5c601153
---
 configure.in | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/configure.in b/configure.in
index 92daf2fe0456..c833b27cb27e 100644
--- a/configure.in
+++ b/configure.in
@@ -2304,6 +2304,11 @@ ia64*-hpux*)
         dnl Probably also a compiler bug, but what can you do?
         PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
         LDFLAGS="$LDFLAGS -DYNAMICBASE"
+        if test "$_CC_MAJOR_VERSION" = "18" -a "$_CC_BUILD_VERSION" = "31101"; then
+            dnl Use MaxILKSize as a workaround for LNK1248 in VS2013update4
+            dnl See https://connect.microsoft.com/VisualStudio/feedback/details/1044914/fatal-error-lnk1248
+            LDFLAGS="$LDFLAGS -MaxILKSize:2147483647"
+        fi
         dnl Minimum reqiurement of Gecko is VS2010 or later which supports
         dnl both SSSE3 and SSE4.1.
         HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1

From a8d1c507ad7fd37ff9c3ff4746bceaa5c1ffae87 Mon Sep 17 00:00:00 2001
From: Christoph Kerschbaumer 
Date: Wed, 18 Feb 2015 12:34:13 -0800
Subject: [PATCH 113/115] Bug 1109910 - Move LoadInfo from docShell into Necko
 (r=sicking,sworkman)

--HG--
rename : docshell/base/LoadInfo.cpp => netwerk/base/LoadInfo.cpp
rename : docshell/base/LoadInfo.h => netwerk/base/LoadInfo.h
rename : docshell/base/nsILoadInfo.idl => netwerk/base/nsILoadInfo.idl
---
 docshell/base/moz.build                    | 3 ---
 {docshell => netwerk}/base/LoadInfo.cpp    | 0
 {docshell => netwerk}/base/LoadInfo.h      | 0
 netwerk/base/moz.build                     | 6 ++++++
 {docshell => netwerk}/base/nsILoadInfo.idl | 0
 5 files changed, 6 insertions(+), 3 deletions(-)
 rename {docshell => netwerk}/base/LoadInfo.cpp (100%)
 rename {docshell => netwerk}/base/LoadInfo.h (100%)
 rename {docshell => netwerk}/base/nsILoadInfo.idl (100%)

diff --git a/docshell/base/moz.build b/docshell/base/moz.build
index b99821324228..4da08ab4d1da 100644
--- a/docshell/base/moz.build
+++ b/docshell/base/moz.build
@@ -20,7 +20,6 @@ XPIDL_SOURCES += [
     'nsIDownloadHistory.idl',
     'nsIGlobalHistory2.idl',
     'nsILoadContext.idl',
-    'nsILoadInfo.idl',
     'nsIPrivacyTransitionObserver.idl',
     'nsIReflowObserver.idl',
     'nsIRefreshURI.idl',
@@ -45,12 +44,10 @@ EXPORTS += [
 EXPORTS.mozilla += [
     'IHistory.h',
     'LoadContext.h',
-    'LoadInfo.h',
 ]
 
 UNIFIED_SOURCES += [
     'LoadContext.cpp',
-    'LoadInfo.cpp',
     'nsAboutRedirector.cpp',
     'nsDefaultURIFixup.cpp',
     'nsDocShell.cpp',
diff --git a/docshell/base/LoadInfo.cpp b/netwerk/base/LoadInfo.cpp
similarity index 100%
rename from docshell/base/LoadInfo.cpp
rename to netwerk/base/LoadInfo.cpp
diff --git a/docshell/base/LoadInfo.h b/netwerk/base/LoadInfo.h
similarity index 100%
rename from docshell/base/LoadInfo.h
rename to netwerk/base/LoadInfo.h
diff --git a/netwerk/base/moz.build b/netwerk/base/moz.build
index 7075d5ad162a..877365bba5d2 100644
--- a/netwerk/base/moz.build
+++ b/netwerk/base/moz.build
@@ -53,6 +53,7 @@ XPIDL_SOURCES += [
     'nsILoadContextInfo.idl',
     'nsILoadGroup.idl',
     'nsILoadGroupChild.idl',
+    'nsILoadInfo.idl',
     'nsIMIMEInputStream.idl',
     'nsIMultiPartChannel.idl',
     'nsINestedURI.idl',
@@ -152,6 +153,10 @@ EXPORTS += [
     'nsURLParsers.h',
 ]
 
+EXPORTS.mozilla += [
+    'LoadInfo.h',
+]
+
 EXPORTS.mozilla.net += [
     'ChannelDiverterChild.h',
     'ChannelDiverterParent.h',
@@ -174,6 +179,7 @@ UNIFIED_SOURCES += [
     'Dashboard.cpp',
     'EventTokenBucket.cpp',
     'LoadContextInfo.cpp',
+    'LoadInfo.cpp',
     'NetworkActivityMonitor.cpp',
     'nsAsyncRedirectVerifyHelper.cpp',
     'nsAsyncStreamCopier.cpp',
diff --git a/docshell/base/nsILoadInfo.idl b/netwerk/base/nsILoadInfo.idl
similarity index 100%
rename from docshell/base/nsILoadInfo.idl
rename to netwerk/base/nsILoadInfo.idl

From 19fbe7e4cfdecd389cfe4c93fffc39b62336baa2 Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 12:50:35 -0800
Subject: [PATCH 114/115] Bumping gaia.json for 7 gaia revision(s) a=gaia-bump

========

https://hg.mozilla.org/integration/gaia-central/rev/42da22fe3d59
Author: Gareth Aye 
Desc: Merge pull request #28289 from gaye/retry-handle-bad-marionette-mocha-output

Add logging and error to retry script for case when marionette-mocha output is missing a=test-only

========

https://hg.mozilla.org/integration/gaia-central/rev/67df20d88567
Author: gaye 
Desc: Fix regexp

========

https://hg.mozilla.org/integration/gaia-central/rev/c8767c4c6123
Author: gaye 
Desc: Add logging and error to retry script for case when marionette-mocha output is missing epilogue

========

https://hg.mozilla.org/integration/gaia-central/rev/154f65bb243a
Author: Zibi Braniecki 
Desc: Merge pull request #28156 from zbraniecki/1132038-l10n-allows-values-to-be-empty

Bug 1132038 - [L10n] Allow values to be empty. r=stas

========

https://hg.mozilla.org/integration/gaia-central/rev/190f1efccabc
Author: Zibi Braniecki 
Desc: Bug 1132038 - [L10n] Allow values to be empty

========

https://hg.mozilla.org/integration/gaia-central/rev/e1bbd8f687b9
Author: autolander 
Desc: Bug 1129584 - merge pull request #28036 from davidflanagan:bug1129584.3 to mozilla-b2g:master

========

https://hg.mozilla.org/integration/gaia-central/rev/052021141503
Author: David Flanagan 
Desc: Bug 1129584 - initialize MediaDB and start creating thumbnails sooner
---
 b2g/config/gaia.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index c283d7985c0b..472b4cbf776d 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
-        "git_revision": "cb452d55651beb33ae19a513824ad79d61799495", 
+        "git_revision": "620aecfde85a8b093247837c55de2708e22be1e1", 
         "remote": "https://git.mozilla.org/releases/gaia.git", 
         "branch": ""
     }, 
-    "revision": "6c1ba29d642ff2c115c2903ad08c5ba0638efbb8", 
+    "revision": "42da22fe3d59646d07bad417e194969dd2cc891d", 
     "repo_path": "integration/gaia-central"
 }

From e6ec84de5df96984b0dfba138cf1b7e15fb22b1f Mon Sep 17 00:00:00 2001
From: B2G Bumper Bot 
Date: Wed, 18 Feb 2015 12:53:00 -0800
Subject: [PATCH 115/115] Bumping manifests a=b2g-bump

---
 b2g/config/dolphin/sources.xml      | 2 +-
 b2g/config/emulator-ics/sources.xml | 2 +-
 b2g/config/emulator-jb/sources.xml  | 2 +-
 b2g/config/emulator-kk/sources.xml  | 2 +-
 b2g/config/emulator/sources.xml     | 2 +-
 b2g/config/flame-kk/sources.xml     | 2 +-
 b2g/config/flame/sources.xml        | 2 +-
 b2g/config/nexus-4/sources.xml      | 2 +-
 b2g/config/nexus-5-l/sources.xml    | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index db67f7206769..c2eb37c1ffa3 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index ab60b8f04f2e..780d9b322223 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index 921b83df918f..cc317c20a9b2 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index 445d9990719c..f54861fc64c2 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index ab60b8f04f2e..780d9b322223 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
     
   
   
-  
+  
   
   
   
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index aa04a810b8c1..3c6a68a2388c 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+  
   
   
   
diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml
index cb4f05c32922..14506eba9152 100644
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index 39b2f35d881c..b42f7fc6d294 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -17,7 +17,7 @@
   
   
   
-  
+  
   
   
   
diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml
index 089d236671ee..03302b746e0a 100644
--- a/b2g/config/nexus-5-l/sources.xml
+++ b/b2g/config/nexus-5-l/sources.xml
@@ -15,7 +15,7 @@
   
     
   
-  
+